I would like to make a report from msinfo32 command to a nfo file in user's desktop folder. I run this exe directly because command msinfo32
sometimes is not in XP's PATH. So, this is what I would like from C#:
"C:\Program Files\Common Files\Microsoft Shared\MSInfo\msinfo32.exe" /nfo C:\Users\someUser\Desktop\my_pc.nfo
I have this code for now, it calls UAC and then the cmd window closes. The file is not created. Why is this not working?
var proc1 = new ProcessStartInfo();
string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
string myFile = "my_pc.nfo";
string myFullPath = Path.Combine(desktopPath, myFile);
string myCommand = @"/C C:\Program Files\Common Files\Microsoft Shared\MSInfo\msinfo32.exe /nfo " + myFullPath;
proc1.UseShellExecute = true;
proc1.WorkingDirectory = @"C:\Windows\System32";
proc1.FileName = @"C:\Windows\System32\cmd.exe";
proc1.Verb = "runas";
char quote = '"';
proc1.Arguments = "/C " + quote + myCommand + quote;
proc1.WindowStyle = ProcessWindowStyle.Normal;
Process.Start(proc1);
Console.ReadLine();