Tag: processstartinfo win32exception

Win32Exception:目录名无效

我正在尝试以不同的用户身份运行一个进程,该用户在运行Vista并启用了UAC的2台不同计算机上具有管理员权限但在其中一个用户中我收到一条说“目录名无效”的Win32Exception 谁能告诉我我的代码有什么问题? var myFile = “D:\\SomeFolder\\MyExecutable.exe”; var workingFolder = “D:\\SomeFolder”; var pInfo = new System.Diagnostics.ProcessStartInfo(); pInfo.FileName = myFile; pInfo.WorkingDirectory = workingFolder; pInfo.Arguments = myArgs; pInfo.LoadUserProfile = true; pInfo.UseShellExecute = false; pInfo.UserName = {UserAccount}; pInfo.Password = {SecureStringPassword}; pInfo.Domain = “.”; System.Diagnostics.Process.Start(pInfo); UPDATE 执行上述代码的应用程序具有requireAdministrator执行级别。 我甚至将工作文件夹设置为“Path.GetDirectoryName(myFile)”和“New System.IO.FileInfo(myFile).DirectoryName”