I'm trying to run the Windows System Assessment Tool (winsat.exe) using the following code:
System.Diagnostics.Process WinSPro =
new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo WinSSInfo =
new System.Diagnostics.ProcessStartInfo();
WinSSInfo.FileName = "cmd.exe";
WinSSInfo.Arguments = "/k winsat.exe";
WinSPro.StartInfo = WinSSInfo;
WinSPro.Start();
This code works if I only call cmd.exe, and even if I call regedit.exe it still works. However, when I try to call winsat.exe as a argument of cmd.exe, it fails. The command prompt shows this:
'winsat.exe' is not recognized as an internal or external command, operable program or batch file.
I tried several ways to call winsat.exe:
Call it directly by assigning
"winsat.exe"
toProcessStartInfo.FileName
. It fails with aWin32Exception
:The system cannot find the file specified
As above, using the full path -
@"c:\windows\system32\winsat.exe"
. It fails with the same error.Run the code as the System Administrator. It still fails.
Call winsat.exe as in the coded example. It failed as I explained earlier.
It's interesting that the command prompt launched from the code can only see .dll files in c:\windows\system32.
Does anyone have any idea why winsat.exe cannot be launched through System.Diagnostics.Process
? Are there any limitations which I've misunderstood?
Thanks,
Rex
winsat.exe
? – Soteriology