How to execute programs in the same directory as the windows batch file?

前端 未结 2 1307
执笔经年
执笔经年 2021-01-30 09:54

I have in the same folder a .bat and a .exe file. I couldn\'t call the .exe file from the .bat unless I put the full absolute

2条回答
  •  耶瑟儿~
    2021-01-30 10:39

    Try calling the .exe with %~dp0, like this: %~dp0MyProgram.exe.

    %0 contains the full path to the called .bat file.

    ~dp says to get the drive and path, including trailing \.

提交回复
热议问题