使用VB.net备份注册表时出现Win32Exception错误

使用VB.net备份注册表时出现Win32Exception异常
本帖最后由 qqqhhhhh1111 于 2012-12-01 09:04:08 编辑 欲使用VB.net备份整个项HKEY_CURRENT_USER\Software\abc\def
该注册表项存在。


If SaveFileDialog1.ShowDialog = DialogResult.OK Then System.Diagnostics.Process.Start("%Systemroot%\System32\regedt32.exe /e """ & SaveFileDialog1.FileName & """ HKEY_CURRENT_USER\Software\abc\def")


结果调试时出现在 System.ComponentModel.Win32Exception 中第一次偶然出现的“System.dll”类型的异常:未处理 System.ComponentModel.Win32Exception:系统找不到指定的文件。

异常详细信息:
引用
未处理 System.ComponentModel.Win32Exception
  ErrorCode=-2147467259
  Message=系统找不到指定的文件。
  NativeErrorCode=2
  Source=System
  StackTrace:
       在 System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
       在 System.Diagnostics.Process.Start()
       在 System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
       在 System.Diagnostics.Process.Start(String fileName)
       在 Timetable.OptionForm.Button1_Click(Object sender, EventArgs e) 位置 F:\Users\Poweruser\Documents\Visual Studio 2010\Projects\课程表\课程表\OptionForm.vb:行号 42
       在 System.Windows.Forms.Control.OnClick(EventArgs e)
       在 System.Windows.Forms.Button.OnClick(EventArgs e)
       在 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       在 System.Windows.Forms.Control.WndProc(Message& m)
       在 System.Windows.Forms.ButtonBase.WndProc(Message& m)
       在 System.Windows.Forms.Button.WndProc(Message& m)
       在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       在 System.Windows.Forms.Application.RunDialog(Form form)
       在 System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
       在 System.Windows.Forms.Form.ShowDialog()
       在 Timetable.MainForm.Button1_Click(Object sender, EventArgs e) 位置 F:\Users\Poweruser\Documents\Visual Studio 2010\Projects\课程表\课程表\MainForm.vb:行号 4