After searching for an answer I found some hints on strange variables under https://blogs.msdn.microsoft.com/oldnewthing/20100506-00/?p=14133
use %=c:%)
for the current directory of drive c or %=w:%)
for w
Or in a batch script:
cd c:\Windows
cd w:\Downloads
(echo %=c:%)
(echo %=w:%)
UPDATE
As @RossRidge pointed out it is not Windows storing those strange variables but the DOS command processor. Those strange variables are only known in the current 'session'. The same holds for cd
(see comment of @Stephan)
Opening two DOS command processors:
In the first DOS command processor:
cd c:\Windows
cd w:\Downloads
(echo %=c:%)
-> c:\Windows
(echo %=w:%)
-> w:\Downloads
cd w:
-> w:\Downloads
In the second DOS command processor:
(echo %=w:%)
-> %=w:% <- this variable is not set, not known
cd w:
-> w:\
Notice the inconsistent way to hold the 'current directory': cd
returns the root directory after entering a DOS command processor. But %=w:%
is not set until the directory changes!