Let's say I have these commands:
Prog1.exe
D:\SomeDir\Prog2.exe
Prog3.exe
Now, say for the second line, I would like the working directory to be D:\SomeDir, but in Prog1.exe and Prog3.exe I want the default working directory (normally, where my .bat file is). If I try this
Prog1.exe
cd D:\SomeDir
D:\SomeDir\Prog2.exe
Prog3.exe
Apparently Prog3 will be executed in SomeDir, which is not what I want.
You could use the pushd/popd commands (help with pushd /?
)
Prog1.exe
Pushd D:\SomeDir
Prog2.exe
popd
Prog3.exe