How to set the working directory of a command in a Windows batch file?

前端 未结 3 842
庸人自扰
庸人自扰 2020-12-29 01:26

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

3条回答
  •  醉话见心
    2020-12-29 02:09

    What worked for me is adding a /d:

    cd /d C:\nginx
    ECHO Stopping nginx...
    start nginx -s quit
    

    (When I didn't have the /d, it didn't work.)

    https://stackoverflow.com/a/18310141/470749 tries to explain it.

提交回复
热议问题