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,595 other followers

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.


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 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

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: