Problem solve Get help with specific problems with your technologies, process and projects.

How do I use the System.Diagnostic.Process to execute an MSDOS .exe file?

I'm using ASP.NET and want to execute an MSDOS executable with some parameters like this example: software.exe -i -x fileIn.htm fileOut.htm

How do I use System.Diagnostic.Process to execute this .exe with parameters? Could you give me the code lines with this example?

Thanks for your answer.
The Process class has a StartInfo property that is used to specify the behavior of your newly created process. The following code starts the command prompt, passing "/?" as a parameter, to show the associated help. It redirects the output so we can get it and show it on the page:

Process p = new Process();
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.FileName = "cmd";
p.StartInfo.Arguments = "/?";

This was last published in August 2003

Dig Deeper on Win Development Resources

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.