Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent error pop-up message box for failed program (.exe) when running batch file

I'm running a test script from batch file.

Because it is test, the programs are expected to fail once in a while. It is file as long as error code is returned so I can continue and mark specific test as failed.

However there is very annoying behavior of executable files under Microsoft Windows - if something fails it pop-ups window like:

This application has failed to start because foo.dll was not found, Re-installing the application may fix the problem

<OK>

Or even better:

The instruction at "..." referenced to memory at "..." ..

Click on OK to terminate the program
Click on CANCEL to debug the program

The result is known - the script execution blocks till somebody presses "Ok" button. And when we talk about automatic scripts that may run automatically at night in some headless virtual machine, it may be very problematic.

Is there a simple way to prevent such behavior and just make an application to exit with failure code - without changing the code of the program itself?

Is this possible at all?

like image 694
Artyom Avatar asked Oct 31 '10 07:10

Artyom


1 Answers

The answer is following: You need to disable WER.

Simplest description for this I found at http://www.noktec.be/archives/259

Simply (ON XP): Right Click on My Computer > Advanced > Error Reporting > Disable

Voila - programs crash silently!

This does not solves problem when DLL is missing, but this is much rare case and this is good enough for me.

like image 138
Artyom Avatar answered Sep 18 '22 13:09

Artyom