代码之家  ›  专栏  ›  技术社区  ›  Kiquenet user385990

如何在UNC文件夹中调用BAT脚本并避免Win32Exception(0x80004005):该操作已被用户取消

  •  0
  • Kiquenet user385990  · 技术社区  · 6 年前

    我使用VS 2017社区、Windows窗体应用程序,并尝试调用BAT脚本(在UNC文件夹中):

    Process.Start(@"\\sharefolder\editHosts.bat");
    

    有时我会出错:

    ComponentModel.Win32Exception异常(0x80004005):操作已被用户取消
    在系统诊断过程.StartWithShellExecuteEx(处理startInfo startInfo)
    在系统诊断过程.Start()

    我已经检查了以下内容:

    • 文件夹已存在
    • 用户拥有文件夹的权限(可以在资源管理器中打开)

    0 回复  |  直到 6 年前