Dos batch stops on error (using Process.start method), how do I continue on error?

I have an applicaion that starts batch files on a schedule, the problem is when the application has an error the process stops.

Example, the batch file gets an error "File not found" this causes the application to stop processing the batch file. When the batch file is run by itself in a command prompt it works fine, it shows the error and continues.

Here is some of the code,

stateInfo is a class containing the information for the job,


Answer this question

Dos batch stops on error (using Process.start method), how do I continue on error?

  • Mikael Håkansson

    are you sure the working directory is set to the location of where the batch file is placed

  • Chirag Patel

    Try making this false:

    runProcess.StartInfo.RedirectStandardOutput = True



  • Tarana

    I double checked a found this to be the cause, the directory was input wrong,

    thanks


  • Dos batch stops on error (using Process.start method), how do I continue on error?