Reputation: 7123
What is the correct script to run a certain exe
file on a post build event?
Upvotes: 21
Views: 35269
Reputation: 1820
None of these answers worked for me.
Even though my exe was at the file path I provided, it still exited with a code of "whatever" and never worked.
Then I did this:
cd $(ProjectDir)
"MyProgram.exe"
...both on separate lines in the post build event command line editor.
My app is located in the project directory. They didn't work on the same line, but separate lines worked fine.
Upvotes: 3
Reputation: 23108
Provided answer is correct, however providing the full path is not always necessary.
Example: run one of the projects output executable.
Always
"$(ProjectDir)bin\Debug\maybe_just_refreshed.exe"
or better version suggested by m93a
: "$(TargetDir)maybe_just_refreshed.exe"
(this compansates for the cases when output location is customized (not the default bin\Debug
).Upvotes: 12
Reputation: 10532
Just as you would run this .exe from command-line. So, specify your .exe with full path and enclose it in double-quotes if either path or executable name contain spaces.
Upvotes: 28