0

Im trying to make this launcher for my game. But I can't seem to find anywhere, how to open a file. Without specifying the location. Like I want it to run a file, from the same folder as the .cmd file is in. (The one I created). Been searching for ages, without finding out how.

Reasoning: The user is able to change where the game is going to be installed. So I cant specify a location..

Minac2503
  • 1
  • 1

3 Answers3

0

Simply open Command Prompt. Then Drag and Drop your .exe file to the console. (This will copy the location of the .exe file to the console) Then just press "Enter". Then your .exe file should be running.

References http://www.howtogeek.com/209694/running-an-.exe-file-via-command-prompt/

Hope it helps

Cameron
  • 26
  • 5
0

The argument %0 of a batch file references the name of that batch file. So to run an exe located in the same folder where your batch file is, use:

%~dp0program.exe

The ~dp expands the argument %0 to a full qualified path name - including a trailing \ that's why there is no \ between %~dp0 and program.exe

Details about expanding variables can be found by typing help for on the commandline

0

Turned out, it was just me being foolish. Forgot that I could just type in the name of the file. Instead of doing something big out of it. Thanks @ByteHamster for refreshing my memory :)

"Quote" ByteHamster: If you are in the same folder, just type in the name of the exe file.

Minac2503
  • 1
  • 1