So I have a chunk of code to call powercfg with the /requests option and get the result back from stdout.
Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "powercfg";
p.StartInfo.Arguments = "/requests";
p.Start();
string output = p.StandardOutput.ReadToEnd();
p.WaitForExit();
However when I run this code I get entirely different output than when I run the same command on the command line.
In the case of the code version I only get a load of "[DRIVER] ?" values back, but on the command line I get usually 2 or 3 properly formed responses.
I've run my code from the same command prompt window as the same user with the same environment, still no joy.
Any ideas ?