我需要运行位于我域中的网络驱动器上的 exe 文件。该驱动器以“M:\”的形式成功连接到我的 PC,但我知道 Process.Start(string, string...) 在启动位于网络共享上的进程时需要具有文件的 URL 路径。
这是我的代码:
string user = "user";
string password = "Qwerty1";
string domain = "nwtraderds";
string open = "file://myshare\dir1\dir2\dir3\test.exe";
string PwString = password;
char[] PasswordChars = PwString.ToCharArray();
SecureString Password = new SecureString();
foreach (char c in PasswordChars)
Password.AppendChar(c);
System.Diagnostics.Process.Start(open, user, Password, domain);
有趣的是:
System.Diagnostics.Process.Start(open);
工作正常。我的想法已经用完了,有人可以帮助我吗?