This seems like something simple, but I don't seem to be able to get it. I have a directory called "test" with an executable hello.exe that basically prints "hello" onto the screen.
I want to execute this program from the current directory using relative paths. So I write
test\hello.exe
Thinking it would execute the program "hello.exe" located in directory "test". But it doesn't. Am I missing something?
Try the following in the batch file:
%~dp0test\hello.exe
The "%~dp0" is a variable that gets replaced with the full path of the batch file, so that it should work even if you don't set the current directory of the batch file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With