使用过程.开始在共享文件夹上执行文件

本文关键字:文件夹 执行 文件 共享文件 共享 过程 开始 | 更新日期: 2023-09-27 18:01:40

我试图通过使用Process. start()来启动一个新的进程,当我传入

时效果很好
   Process.Start("C:''Documents and Settings''Upload.exe")

但是否可以执行相同的操作,当我移动Upload.exe到我的网络位置下的共享文件夹?I tried

   Process.Start("''Shared Folder''Upload.exe");

但我得到一个Win32Exception。

使用过程.开始在共享文件夹上执行文件

应该使用UNC路径访问网络资源。(当你把你的文件放到共享路径中时,它就变成了一个网络资源)

UNC路径采用以下形式:

''ServerName'SharedPath'YourFile.exe

''ServerName'D$'SharedPath'YourFile.exe

其中D$为驱动器号。

在你的情况下,你可能不得不使用下面的

Process.Start(@"''Server-Name'Shared Folder'Upload.exe");

在字符串前使用@符号,因为您的''将被视为',作为转义字符。

尝试"''''Shared Folder''Upload.exe"@"''Shared Folder'Upload.exe"