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 directo
You could use the cd command (help with cd /?) with the %~dp0, batch file path, variable.
Prog1.exe
cd D:\SomeDir
Prog2.exe
cd %~dp0
Prog3.exe
For a complete list of %~ modifiers see call /? or for /? help.
However, I only add this as to provide a more complete answer on Stack Overflow. I would RECOMMEND using jeb's solution above.