문제

I am trying to run sysprep from a vb.net application, and even though the path and file name are confirmed accurate, it is returning that it can not find the file. I've tried using process.start, declaring as a new process, declaring the path separate from the file name. Here is the code as I would like it to be written, maybe someone could try it out and see if they come up with a solution?

Private Sub btnsysp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsysp.Click
    Dim P As New System.Diagnostics.Process()
    P.StartInfo.UseShellExecute = True
    P.StartInfo.WorkingDirectory = "C:\Windows\System32\sysprep\"
    P.StartInfo.FileName = "sysprep.exe"
    P.Start()
End Sub
도움이 되었습니까?

해결책

I think you just stumbled uppon the http://msdn.microsoft.com/en-us/library/aa384187.aspx

The %windir%\System32 directory is reserved for 64-bit applications. Most DLL file names were not >changed when 64-bit versions of the DLLs were created, so 32-bit versions of the DLLs are stored in a >different directory. WOW64 hides this difference by using a file system redirector.

What happens is that your launch request (from a 32-bit process) is being redirected to %windir%\SysWOW64\sysprep\sysprep.exe. Since there's no 32-bit version of this particular executable on SysWOW64 the launch fails.

The easiest way to bypass this problem is using reference to %windir%\SysNative\sysprep\sysprep.exe instead of %windir%\System32\sysprep\sysprep.exe which is what you have.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top