This is a stupid and complicated problem that I have encountered.
The code below works well (it starts the calculator):
ProcessStartInfo psStartInfo = new ProcessStartInfo();
psStartInfo.FileName = @"c:\windows\system32\calc.exe";
Process ps = Process.Start(psStartInfo);
However below for SoundRecorder does not work. This gives me "System error cannot find file."
ProcessStartInfo psStartInfo = new ProcessStartInfo();
psStartInfo.FileName = @"c:\windows\system32\soundrecorder.exe";
Process ps = Process.Start(psStartInfo);
I can start Sound Recorder using the command Start β Run β "c: \ windows \ system32 \ soundrecorder.exe".
Any idea what is going wrong?
I am using C # in Visual Studio 2015 and am using Windows 7.
UPDATE 1 : I tried the check File.Existsand it shows me a MessageBox from the code below:
if (File.Exists(@"c:\windows\system32\soundrecorder.exe"))
{
ProcessStartInfo psStartInfo = new ProcessStartInfo();
psStartInfo.FileName = @"c:\windows\system32\soundrecorder.exe";
Process ps = Process.Start(psStartInfo);
}
else
{
MessageBox.Show("File not found");
}
source
share