Hello there my code is like that:
if (result == System.Windows.Forms.DialogResult.Yes)
{
try
{
Process myProcess = new Process();
// Launch the usb backup creator
myProcess.StartInfo.UseShellExecute = false;
// get path of recovery drive
myProcess.StartInfo.FileName = (Environment.SystemDirectory + "\\RecoveryDrive.exe"); ;
myProcess.StartInfo.CreateNoWindow = true;
myProcess.Start();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message,ex.Source);
}
}
The file exists in system32 directory, but the exception thrown says that the file does not exist?
Is that related to UAC privileges?
If you're experiencing the effects of the file system redirector because you're running as a 32-bit process (compiled for 32-bit or for AnyCPU with "Prefer 32-bit") then you probably want to use the following code:
Path.Combine(Environment.GetFolderPath(SpecialFolder.Windows),
"sysnative",
"RecoveryDrive.exe");
to get the correct path. You can determine if this is the case by checking the Environment.Is64BitProcess
property.
References:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.