Re: Whats the %=C:% environment variable used for ?

Frank Slootweg <[email protected]> 6 Feb 2026 15:26:06 GMT
Newsgroups alt.comp.os.windows-xp,alt.windows7.general,alt.comp.os.windows-10
Organization NOYB
Message-ID <[email protected]>
R.Wieser <[email protected]> wrote:
> Hello all,
> 
> A couple of days ago I was looking at the envronment variables, and noticed 
> a variable named "=C:", containing the current path of that drive.

  Current working directory, to be precise.

> Can anyone tell me what it was/is used for ?

  Google, which you apparently don't want to use, says (amongst others):

"The %=C:% environment variable in Windows is a hidden, special
 system-wide variable that stores the current working directory for the
 C: drive. 

 It is part of a legacy mechanism (dating back to MS-DOS) that allows
 the command processor (cmd.exe) to track separate current directories
 for every drive letter, rather than having one single global current
 directory for the whole system. 

 Here are the key details about %=C:%:

 * Function: It keeps track of where you are in the C: drive if you are
   currently working on a different drive (e.g., if you are in D:\Data
   but type cd C:\Users, %=C:% will be updated to C:\Users).

 * Automatic Management: This variable is managed automatically by
   cmd.exe when you use the cd (chdir) command."

> Remarks: Using the command-prompt it doesn't appear in the "set" list, and 
> it can be read, but not written.

  Google confirm that behaviour.

  It also gives a comparison with other variables. such ad %CD%
%SystemDrive% and mentions the somwhat obvious:

"If you change drives, other variables like %=D:%, %=E:%, etc., are
 created for those respective drives.".