Re: Whats the %=C:% environment variable used for ?
"R.Wieser" <[email protected]> Fri, 6 Feb 2026 20:18:29 +0100
| Newsgroups | alt.comp.os.windows-xp,alt.windows7.general,alt.comp.os.windows-10,alt.msdos.batch.nt |
|---|---|
| Organization | A noiseless patient Spider |
| Message-ID | <[email protected]> |
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