Process.Start in C # System cannot find the specified file error

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");
}
+3
source share
2 answers

, 32-, 64- Windows C:\Windows\System32 C:\Windows\SysWOW64 32- . calc.exe , soundrecorder.exe true System32.

Start / Run, - 64- explorer.exe, , 64- C:\Windows\System32\soundrecorder.exe .

:

, 32- % windir%\System32, % windir%\SysWOW64.


[EDIT] :

32- , % windir%\Sysnative % windir%\System32.

, soundrecorder.exe () C:\Windows\System32 .

psStartInfo.FileName = @"C:\Windows\Sysnative\soundrecorder.exe";
+13

,

Process.Start

System.Diagnostics.Process.Start("C:\\MyAppFolder\\MyApp.exe -silent");

ProcessStartInfo info = new ProcessStartInfo("C:\\MyAppFolder\\MyApp.exe");
info.Arguments = "-silent";
Process.Start(info)

.

0

Source: https://habr.com/ru/post/1682645/


All Articles