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
I solved this by changing the working directory using pushd at the start of the script and restoring is at the end of the script using popd. This way you can always assume the working directory is the same as the location of the bat file.
pushd %~dp0
ProgramInSameFolderAsBat.exe
popd
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 \
.