The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,858 other subscribers

The CD pseudo environment variable in batch file: do not overwrite it with a real one!

Posted by jpluimers on 2014/10/08

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.

2 Responses to “The CD pseudo environment variable in batch file: do not overwrite it with a real one!”

  1. Rick's avatar

    Rick said

    I’ve noticed some strange behavior with posting here. If I enter an email that is already in use with a word press account it wants me to login. Since I don’t have a word press account I can’t login. So I try to just change the email address and click “Post Comment” again. But nothing happens.

    BTW… I don’t use email so really you need a way to let people post without entering an email.

Leave a reply to Rick Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.