I have found this via stack-overflow search but no one has given a solution that works. I am writing a simple program and the first part of it is to launch sysprep.exe with some arguments. For some reason sysprep does not launch when code is run. It gives an error that file cannot be found. For e.g. by using the code below Notepad will open with no issues. If I try and open sysprep it will not.
Process.Start(@"C:\Windows\System32\notepad.exe"); -- opens with no issue
Process.Start(@"C:\Windows\System32\sysprep\sysprep.exe"); -- does not open
Any help would be appreciated.
{
public MainWindow()
{
InitializeComponent();
}
private void RadioButton_Checked(object sender, RoutedEventArgs e)
{
if (radioButtonYes.IsChecked == true)
{
Process.Start(@"C:\Windows\System32\sysprep\sysprep.exe");
}
}
It is actually a redirection problem on 64 bit Windows. According to this discussion, the
System32
calls are redirected to theSysWOW64
folder. And sinceC:\Windows\SysWOW64\Sysprep\sysprep.exe
does not exist, you get the error.This is what you want:
Simply use
sysnative
instead.