Is there a way to handle crashing .exe files?

4 views (last 30 days)
Pawel
Pawel on 3 Oct 2013
Commented: dpb on 4 Oct 2013
I'm running an executable file in a loop with different inputs using:
[status, result] = dos(command)
where 'command' specifies the name of the program and the input parameters . For some values of 'command' the underlying .exe file crashes, opening a (system) window telling me that 'xyz.exe has stopped working correctly', and that 'Windows will close the program and notify me if a solution is available'. To close that window I need to click on the 'close program' button that appears in that window.
What I would like to happen is for Matlab to press that button for me - so that I don't need to do that every time a crash occurs, and that the Matlab program can terminate by itself. Any ideas if / how that could be achieved?
Thanks in advance Pawel
  1 Comment
dpb
dpb on 4 Oct 2013
Have you tried wrapping the function in a batch file that uses an errorlevel test of the program return value to see if it can be trapped?
The JPSoft command interpreter has the added facility over the MS-supplied CMD processor of
ON ERROR
that installs an error handler that, if you can upgrade the command processor in use, should work if the other doesn't.
Ideally you could find out which cases are causing the crash and not submit then or modify the code to handle the bum input more gracefully...

Sign in to comment.

Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!