I have a batch file (.bat) in Windows which I am using to run a program. The problem is sometimes the program crashes and I'd like to know when it does. If I double-click the program's .exe in an Explorer window and the program crashes (like if a .dll is missing) then I get a message like
The program can't start because XXXX.dll is missing from your computer. Try reinstalling the program to fix this problem.
But when I run the program through the .bat file, I don't get any indication开发者_StackOverflow that the program crashes - no popup, no output to the command line.
I'm guessing it has something to do with the .bat file absorbing the error message. For reference my .bat file looks like this (shortened to keep the post simple):
start directory\program.exe
I'd like to get an indication that the program has crashed. Is there something I can add to my .bat file to see that?
Using the start command creates a new command line window for program.exe to run in. That window closes immediately when program.exe exits, thereby hiding the error from you.
To fix it, simply change "start directory\program.exe" to "directory\program.exe"
精彩评论