I'm usually not a C# person, so I hope it's not a stupid question...
I have a .bat
file that looks like this (this is of course a simplified example):
file nn.bat
exit /B 3
When I run it from command I see that %ERRORLEVEL%
is 3 (great!!)
I have this c# program:
C# Program
class Program
{
static void Main(string[] args)
{
Process p = new Process();
p.StartInfo.FileName = @"nn.bat";
p.Start();
p.WaitForExit();
int rc = p.ExitCode;
Console.WriteLine(rc);
}
}
I expect rc
to be 3, but it's always 0 no matter what I try ...
Where is my mistake ?