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

    From R.Wieser@3:633/10 to All on Fri Feb 6 11:12:42 2026
    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.

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


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

    Regards,
    Rudy Wieser



    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Mr. Man-wai Chang@3:633/10 to All on Fri Feb 6 21:06:25 2026
    On 2/6/2026 6:12 PM, R.Wieser 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.

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

    Remarks: Using the command-prompt it doesn't appear in the "set" list, and
    it can be read, but not written.
    How about a screenshot?? Could it be caused by insufficient length of
    the PATH string? Or maybe the Command Prompt window's width?

    dos batch "=C:" - Google Search https://www.google.com/search?q=dos+batch+%22%3DC%3A%22


    --
    @~@ Simplicity is Beauty! Remain silent! Drink, Blink, Stretch!
    / v \ May the Force and farces be with you! Live long and prosper!!
    /( _ )\ https://sites.google.com/site/changmw/
    ^ ^ https://github.com/changmw/changmw

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From R.Wieser@3:633/10 to All on Fri Feb 6 15:47:15 2026
    Mr. Man-wai Chang,

    How about a screenshot??

    Of what ?

    Could it be caused by insufficient length of the PATH string? Or maybe the Command Prompt window's width?

    Neither. Its an envronment variables name. As mentioned, using the command-prompt you can read its contents (the current path for that drive), but not set it.

    dos batch "=C:" - Google Search https://www.google.com/search?q=dos+batch+%22%3DC%3A%22

    Google refuses work with browsers that do not have Javascript. The same search using DDG gave me zero results. Thats why I posted the question
    here.

    Regards,
    Rudy Wieser



    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Frank Slootweg@3:633/10 to All on Fri Feb 6 15:26:06 2026
    R.Wieser <address@is.invalid> 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.".

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Mr. Man-wai Chang@3:633/10 to All on Sat Feb 7 00:31:06 2026
    On 2/6/2026 10:47 PM, R.Wieser wrote:
    Mr. Man-wai Chang,

    How about a screenshot??

    Of what ?

    Could it be caused by insufficient length of the PATH string? Or maybe the >> Command Prompt window's width?

    Neither. Its an envronment variables name. As mentioned, using the command-prompt you can read its contents (the current path for that drive), but not set it.
    A screen-shot of the Command Prompt window that showed what you just
    said might help.

    --
    @~@ Simplicity is Beauty! Remain silent! Drink, Blink, Stretch!
    / v \ May the Force and farces be with you! Live long and prosper!!
    /( _ )\ https://sites.google.com/site/changmw/
    ^ ^ https://github.com/changmw/changmw

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From R.Wieser@3:633/10 to All on Fri Feb 6 18:02:59 2026
    Mr. Man-wai Chang,

    How about a screenshot??

    Of what ?
    ...
    A screen-shot of the Command Prompt window that showed what you
    just said might help.

    What about you typing it in your puters console and see for yourself ?
    Just type "echo %=C:%" and see what the result is. No screenshot needed.

    Regards,
    Rudy Wieser



    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From R.Wieser@3:633/10 to All on Fri Feb 6 18:05:40 2026
    Damn, I forgot :

    I tried the brave and bing search-engines too, but they also had dno clue
    what I was talking about.

    Regards,
    Rudy Wieser



    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Kenny McCormack@3:633/10 to All on Fri Feb 6 17:50:55 2026
    In article <10m56t4$bu2j$1@dont-email.me>, R.Wieser <address@is.invalid> wrote: >Mr. Man-wai Chang,

    How about a screenshot??

    Of what ?
    ...
    A screen-shot of the Command Prompt window that showed what you
    just said might help.

    What about you typing it in your puters console and see for yourself ?
    Just type "echo %=C:%" and see what the result is. No screenshot needed.

    First, to answer the thread question: My understanding is that this *is*
    how processes in DOS/Windows keep track of the current directory for each drive. Note that the idea of multiple "current directories" - i.e., the concept of each drive having its own current directory - is kind of unique
    to DOS/Windows. Unix doesn't have it and, in fact, neither does the real underlying (NT) OS in modern Windows. It is something that is emulated in userland software so that modern Windows works similarly to original DOS.

    So, the point is that there are "hidden" environment variables for each
    drive that has a current directory other than \. For example, on the
    machine I just tested this on, every drive other than C: had its current directory at the root, so the only env var I could find was the "=C:\foo\bar\whatever".

    That said, I am genuinely (non-rhetorically) curious as to how you
    discovered this in the first place, given that these variables are not displayed by the DOS "set" command. You'd have needed to use some other
    tool to scan the environment table. For that reason, a screenshot would actually have been useful. Or, you could just tell us how you found it...

    Two other notes:

    1) I first became aware of this from a post made (a long time ago) in
    the tech support forum of some other Windows product, by the devs of
    that product, who are people who know what they are talking about.
    That other product (tool) does, indeed, have the ability to access
    these variables.

    2) (Speaking of screenshots) Given that this is Usenet, and Usenet is
    (supposed to be) a text-only medium, how would one go about posting a
    screenshot, should one desire to do so? Is there any established
    protocol?

    --
    Indeed, most .NET developers couldn't pass CS101 at a third-rate
    community college.
    - F. Russell -

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From R.Wieser@3:633/10 to All on Fri Feb 6 19:16:15 2026
    Frank,

    Current working directory, to be precise.

    Nope, thats something else.

    Google, which you apparently don't want to use,

    Some years ago Google stopped wanting to work with my non-javascript
    browser. Who's choice was that ?

    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.

    Its certainly not system-wide.

    that allows the command processor (cmd.exe)

    Ah, just for the command-processor processes. That makes more sense.

    Here are the key details about %=C:%:
    [snip]

    That explains nothing about its usage.

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

    In the command-processor process the change is made in (iow: nothing "system wide" about it). Yeah, I noticed.


    Bottom line :
    The question still stands : What is the "=C:" environment variable used for
    ?

    Regards,
    Rudy Wieser



    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Herbert Kleebauer@3:633/10 to All on Fri Feb 6 19:16:56 2026
    On 2/6/2026 6:50 PM, Kenny McCormack wrote:

    What about you typing it in your puters console and see for yourself ? >>Just type "echo %=C:%" and see what the result is. No screenshot needed.

    First, to answer the thread question: My understanding is that this *is*
    how processes in DOS/Windows keep track of the current directory for each drive.

    some more information about "Undocumented Dynamic variables":

    https://ss64.com/nt/syntax-variables.html


    and especially for the %=C:% :

    https://devblogs.microsoft.com/oldnewthing/20100506-00/?p=14133

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From R.Wieser@3:633/10 to All on Fri Feb 6 20:18:29 2026
    Kenny,

    First, to answer the thread question: My understanding is that this
    *is* how processes in DOS/Windows keep track of the current directory
    for each drive.

    I doubt it. I tried but could not find any DLL function to change the path for a specific drive.

    neither does the real underlying (NT) OS in modern Windows

    Nor do GUI programs running ontop of it (no "=c:" or similar entry to be seen). iow, it seems to be a quirk of just the command-processors.

    But an NT-era command-processor which actually *uses* environment-variables
    to keep track of them - instead of keeping those paths in some internal
    memory and just updates the environment variable when needed ? Thats hard
    to believe.

    So, the point is that there are "hidden" environment variables for each
    drive that has a current directory other than \.

    Not really my point, and no (see below).

    For example, on the machine I just tested this on, every drive
    other than C: had its current directory at the root, so the only
    env var I could find was the "=C:\foo\bar\whatever".

    Not quite : I just did the test to CD to some folder, change back to the
    root and than executed the program showing all the environment-variables.
    It showed the entry "=C:=c:\".

    iow, it looks like that if an entry for a drive has been created it stays.

    That said, I am genuinely (non-rhetorically) curious as to how
    you discovered this in the first place, given that these variables
    are not displayed by the DOS "set" command.

    Thats easy to explain : the GetEnvironmentStrings function in Kernel32.DLL retrieves them all. :-)

    You'd have needed to use some other tool to scan the environment
    table. For that reason, a screenshot would actually have been
    useful.

    So you guys could see a program named "test.exe" with a number of strings below it, which look like the output of a commandline "set" command ? How would that help anyone ?

    Or, you could just tell us how you found it...

    :-) I did. Now you can ask yourself *why* I used that
    GetEnvironmentStrings function. :-p

    Two other notes:
    ...
    That other product (tool) does, indeed, have the ability to access
    these variables.

    SetEnvironmentVariable, GetEnvironmentVariable and GetEnvironmentStrings are all part of Kernel32.DLL . Most programming languages (and even some scripting ones) can call them them.

    2) (Speaking of screenshots) Given that this is Usenet, and Usenet
    is (supposed to be) a text-only medium, how would one go about
    posting a screenshot, should one desire to do so? Is there any
    established protocol?

    As these newsgroups (on news.eternal-september.org) do not allow attachments you would need to upload them to some image-server, and add the link to it
    to your post.

    Ofcourse, most of those image-servers will want you to create an account
    with them, and will only allow the others to see the uploaded image after having passed some Javascript hurdles.

    For the same reason as Google doesn't work for me those image-servers do not work for me either.

    By the way : some newsgroup servers do allow HTML posting as well as attachments. news.ethernal.september.org mostly disallows them pretty-much everywhere.

    Regards,
    Rudy Wieser



    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From R.Wieser@3:633/10 to All on Fri Feb 6 20:32:27 2026
    Herbert,

    some more information about "Undocumented Dynamic variables":

    https://ss64.com/nt/syntax-variables.html

    Funny: They start with mentioning the allowed characters for the variable
    name, and a bit later on showing that that gets violated.

    And by the way, as I've mentioned a few times, the "=" *can* be part of the variable name (as its first character) just not when trying to write.(to)
    one ("echo %=C:%" does work)

    and especially for the %=C:% :

    https://devblogs.microsoft.com/oldnewthing/20100506-00/?p=14133

    [quote]
    But why put these internal variables in the environment? Can't they just be regular variables inside the cmd.exe process?

    The variables are exported into the environment because you want these "fake per-drive current directories" *to be inherited by child processes*.
    [/quote]
    (bolding mine)

    Yep, at some point I realized that that might be the /only/ reason for them
    to be there.

    [quote]
    What should you do about these variables, then?

    Nothing. Just let them be and do their jobs. I?m just mentioning them here
    so you won?t freak out when you see them.
    [/quote]

    Meh. :-)

    Thanks for the info.

    Regards,
    Rudy Wieser



    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Frank Slootweg@3:633/10 to All on Fri Feb 6 19:46:45 2026
    R.Wieser <address@is.invalid> wrote:
    Frank,

    Current working directory, to be precise.

    Nope, thats something else.

    No, it is, but - as usual - you snipped the/your context. Your
    problem, not ours.

    Google, which you apparently don't want to use,

    Some years ago Google stopped wanting to work with my non-javascript browser. Who's choice was that ?

    And that's our problem exactly how/why?

    If you don't want to use javascript, then fine, but face the
    consequences and don't let others suffer the consequences of your
    choices.

    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.

    See? "current working directory", like I said.

    Its certainly not system-wide.

    It probably was in the "legacy mechanism". Another part you snipped.

    See a pattern there!? :-(

    that allows the command processor (cmd.exe)

    Ah, just for the command-processor processes. That makes more sense.

    Here are the key details about %=C:%:
    [snip]

    That explains nothing about its usage.

    It's usage is rather obvious from the snipped (Sigh!) example. The
    others had no problems understanding it's usage, See for example, but
    not only, Kenny's response.

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

    In the command-processor process the change is made in (iow: nothing "system wide" about it). Yeah, I noticed.

    Bottom line :
    The question still stands : What is the "=C:" environment variable used for ?

    Sigh!

    To know the current working directory on the C: drive, when the
    active working directory is on another drive.

    As it's an environment variable, it can be used in other commands,
    etc..

    C:\home\franks>cd
    C:\home\franks

    C:\home\franks>m:

    echo %=C:%
    C:\home\franks

    cd home

    M:\home>c:

    C:\home\franks>echo %=M:%
    M:\home

    C:\home\franks>

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Herbert Kleebauer@3:633/10 to All on Fri Feb 6 21:24:43 2026
    On 2/6/2026 8:18 PM, R.Wieser wrote:

    As these newsgroups (on news.eternal-september.org) do not allow attachments you would need to upload them to some image-server, and add the link to it
    to your post.

    You can post the screen shot in: de.alt.dateien.misc
    and in the text-only group just give the information
    that you posted it there.

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From J. P. Gilliver@3:633/10 to All on Sat Feb 7 00:05:56 2026
    On 2026/2/6 18:16:15, R.Wieser wrote:

    []

    Bottom line :
    The question still stands : What is the "=C:" environment variable us
    ed for
    ?

    Regards,
    Rudy Wieser


    The command prompt remembers what directory is the current one for each
    "drive letter" you switch to (which can be partitions, drives, SUBSTed "drives", or IIRR network drives).

    It obviously has to remember that _some_where. Whether an "environment variable" is a good choice for that is above my pay grade. But that's
    what it is used for: if in a command prompt you switch to a different
    drive letter, it remembers what directory you were in last tome you left
    that letter.

    --
    J. P. Gilliver. UMRA: 1960/<1985 MB++G()ALIS-Ch++(p)Ar++T+H+Sh0!:`)DNAf

    ... the pleasure of the mind is an amazing thing. My life has been
    driven by the satisfaction of curiosity. - Jeremy Paxman (being
    interviewed by Anne Widdecombe), Radio Times, 2-8 July 2011.

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From R.Wieser@3:633/10 to All on Sat Feb 7 07:31:29 2026
    Herbert,

    You can post the screen shot in: de.alt.dateien.misc
    and in the text-only group just give the information
    that you posted it there.

    I was thinking of aioe.test as a possibility, but wondered (doubted) if that one would propagate to all the other news servers.

    Thanks for the info, I've stored it for future usage.

    Regards,
    Rudy Wieser



    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From R.Wieser@3:633/10 to All on Sat Feb 7 08:30:01 2026
    Arlen,

    Windows contains secrets normally kept hidden under the floorboards.

    Ohhh, omnious.

    Following on what Frank said, it turns out Windows creates "drive-specific current directory" environment variables which look funnily like this.
    =C:
    ...
    Each one stores the current working directory (cwd) for that drive.

    You didn't need Frank for that, its what I mentioned in my initial post.

    Try this:
    C:\> cd \Windows
    C:\Windows> D:
    D:\> cd \Games
    D:\Games> C:
    C:\Windows>
    Notice how switching back to C: returns you to C:\Windows automatically? That's because Windows stored it in that =X: stuff.

    What if I tell you that the contents of those =X: environment variables are only updated from where the data is stored internally. Could you prove me wrong ? Can you prove that you are right ?

    If (when) you can't prove either than your above statement is nothing more than an idea that you, as so often, present as if its a fact.

    They're maintained internally by the OS,

    No, they are not.

    not by the shell

    "the shell" ? Whats that ? I know a few programs I could refer to as shells.

    so you can't read them (echo %=C:%) or see them with set or even write to them.

    Funny that, you claim you can't read / see them using the command
    interpreters "set" command ...

    Try these proof-of-concept examples:
    C:\> cd \Windows
    C:\Windows> echo %=C:%
    C:\Windows

    Switch drives:
    C:\Windows> D:
    D:\> echo %=C:%
    C:\Windows
    It stays the same until you change directories on C:.

    ... and here, directly below it, you are telling me that you *can* read /
    see them.

    So, which one is it ?

    Bottom line :
    I don't believe that those environment variables are *used* to remember the different drives current paths. Nowerdays the actual, used paths are most likely stored internally, and the environment variables contents are updated from them.

    However, one believable reason to have them available as environment
    variables has been mentioned by someone.

    Regards,
    Rudy Wieser



    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From R.Wieser@3:633/10 to All on Sat Feb 7 11:13:13 2026
    Frank,

    Current working directory, to be precise.

    Nope, thats something else.

    No, it is,

    Yes, it is. Prove me wrong, why don't you.

    Thats the whole problem with people like you. You guys claim wrongdoing,
    but for "some reason" (yeah, right) "forget" to provide substanciation for such a claim.

    .. I wonder why ... <whistle>

    but - as usual - you snipped the/your context.

    And as always you complain about me/others do not quote to your liking but
    *as always* "forget" to mention how they *should* have done it.

    Ofcourse, if you /would/ do that than there is a big chance that me/those others would point out that most of what you want to see quoted has zero to
    do with the provided reply.

    You think otherwise ? Than put your money where your mouth is and prove it.

    Also, in the past you've shown yourself to be quite hypocritical about such quoting, snipping stuff that was actually part of what re reply was about.

    Bottom line,
    your "you're (quoteing) wrong!" <full stop> claims have long ago ceased to impress me.

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

    See? "current working directory", like I said.

    What I see is that you "forgot" to read the whole line, especially the part after "current working directory". Whats that about again about others snipping important information ? You're the pot who claims that the kettle is black.

    FYI: Windows processes have a "current working directory" that has *nothing* to do with the ones for each drive.

    Worse : programs do not even have a possibility to do a "cd". Thats all the command processors doing.

    Its certainly not system-wide.

    It probably was in the "legacy mechanism". Another part you
    snipped.

    See a pattern there!? :-(

    Yeah, I do. You have very little actual knowledge about how Windows works
    and even when someone hits you with a clue bat you will refuse to check it
    out for yourself.

    Here are the key details about %=C:%:
    [snip]

    That explains nothing about its usage.

    It's usage is rather obvious from the snipped (Sigh!) example.

    :-) Kiddo, I said *USAGE*, not how the command-processor changes it when
    you do something like a CD. Learn to read. *Deep sigh*

    The others had no problems understanding it's usage, See for
    example, but not only, Kenny's response.

    Most all of the others skirted the question. Just like you. Only one person provided something thats plausible, and it wasn't Kenny.

    The question still stands : What is the "=C:" environment variable used
    for ?

    Sigh!

    To know the current working directory on the C: drive, when the
    active working directory is on another drive.

    Idiot. You must have never heard of relative paths.

    And no, a programmer being of sound mind would *not* use that environment variable for it. There are better ways to get a drives "current working directory".

    As it's an environment variable, it can be used in other commands,
    etc..

    And there we are, arriving at the question (in the caption and the first
    post) : Whats the %=C:% environment variable used for ?

    In all my years I've never seen it used (in batch files or otherwise). Probably because command processors also recognise and can work with
    relative paths.

    Regards,
    Rudy Wieser



    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)