Bruno Řehak
Bruno Řehak

Reputation: 21

How to run .exe with .bat file in same dir

I am making a program that will auto run files for me but i want to run a .exe file from the same place or directory that the run.bat file is!

I have bin tring like this:

:FarCry 2
echo Starting game...
start FarCry2.exe
pause
:exit

But it wont start! why?

Upvotes: 2

Views: 10131

Answers (2)

Magoo
Magoo

Reputation: 80211

Try

start "" "%~dp0farcry2.exe"

which should prepend the batch's drive&directory to the executable name.

Adding the empty "window title" is simply common practice to overcome START's strange syntax.

Upvotes: 5

Nagasaki
Nagasaki

Reputation: 58

if FarCry2.exe is in the same folder than your run.dat replace FarCry2.exe by ./FarCry2.exe

Upvotes: 0

Related Questions