How to determine where the exit code comes from?

Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.FileName = @"PsExec.exe";
p.StartInfo.Arguments = @"\\10.10.1.127 -accepteula -i -u administrator -p 1 -n 10 c:\myapp.exe";
p.Start();

How to determine if the p.ExitCodecode comes from PsExecor myapp.exe?

+4
source share
1 answer

Use a combination of a non-zero error code and parsing the last two lines of output from PsExec.

0
source

Source: https://habr.com/ru/post/1608006/


All Articles