Trying to run a file located in System32 as an administrator, but he continues to tell me that it does not exist.
Error: the system cannot find the specified file. Assembly platform: x86. Current OS: Windows 8.1 x64. I would prefer not to have 2 different .exe for 32 and 64 bit os.
p.StartInfo.Verb = "runas";
p.StartInfo.FileName =
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System),"Defrag.exe");
p.StartInfo.Arguments = @"c:\ /A";
p.Start();
p.WaitForExit();
I also tried the following with no luck
p.StartInfo.FileName =
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "sysnative", "Defrag.exe");
Update
Switching the application from x86 to any processor fixed the problem
source
share