Turn out that there is a solution, not the cleanest but it works. Basically you have to do this:
pushd "%~dp0"
REM ... do your stuff
popd
What pushd does is automatically map the given parameter as a drive and popd removes the mapping. Not the best solution, but a working one. And the "%~dp0" parameter gets you the current directory of the batch file.
4 comments:
Excellent. Fixed the issue for me.
nice one...although I've found the batch I use still works without it..good old MS.
Thank you so much, I have been guessing and checking DOS commands for hours, this simplifies many tasks for me
Great, thanks! Also you can use %~dp0 on its own. For example what I have done is:
set CURRENT_PATH=%~dp0
%CURRENT_PATH%\my.exe
Works well, too!
Post a Comment