I never realized you could overwrite the CD pseudo environment variable. If you do, the automatic value of the pseudo variable will not be udpated any more:
You have at some point set the CD variable explicitly. If you do this it will no longer automatically reflect the current working directory. To undo this, set it to empty:
set CD=
Thanks Jonathan and … for explaining this in both your answers.
Thanks to another answer by Endoro I now also know of the %=C:% pseudo variable (you have one per drive letter) that indicate the current directory per drive letter.
–jeroen
via: batch file – When is the CD environment variable updated? – Stack Overflow.





