Click here to Skip to main content
15,885,987 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I want to execute these dos commands:

ProcessStartInfo info = new ProcessStartInfo("batchisp");
info.Arguments = "-device at90usb1287 ... -operation addrange 00 read";
Process.Start(info);


Now my question is so simple. I want the return value of any command execution. For example the read operation's return value to decide sth according to it or the verify operation's return value to see if it was successfull. Please write your answer including c# code. Thanks!
Posted
Updated 5-Nov-10 1:44am
v2

 
Share this answer
 
Comments
shakil0304003 5-Nov-10 11:50am    
Good Answer.
Dalek Dave 5-Nov-10 11:55am    
Good Call.
C#
process myProcess=process.start("notepad.exe")
Console.WriteLine();
Console.WriteLine("Process exit code: {0}",myProcess.ExitCode);
 
Share this answer
 
Comments
OriginalGriff 5-Nov-10 8:44am    
Which will immediately throw an exception: "Invalid Operation Exception" because Notepad has not exited. Read up on the link I gave in my answer for details on how to handle this properly!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900