Wednesday, November 17, 2010

How do you change directories using environmental variables in windows shell (command prompt) ?

I know how to set the value to a variable ( set %26lt;name%26gt;=value) In this case I am creating a variable to point toward a directory. Now in the shell (xp) how do i switch to the directory using the variable I created? I tried cd %26lt;name%26gt; or chdir %26lt;name%26gt; and neither work, what am I doing wrong?How do you change directories using environmental variables in windows shell (command prompt) ?
You need to put %s around your environment variable. For example...



set myFavoriteDir=c:\windows

cd %myFavoriteDir%

No comments:

Post a Comment