如何在System.Diagnostics.Process.Start中将凭证/参数传递给exe

时间:2015-03-25 07:47:49

标签: c# asp.net .net skype

string x = @"C:\Program Files (x86)\Skype\Phone\Skype.exe /secondary /username:myusername /password:mypassword";
System.Diagnostics.Process.Start(x);

我在C#windows桌面应用程序中运行代码时遇到以下错误

"System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified"

注意:

- 但是如果我在运行窗口输入网址,那么Skype午餐成功并登录(窗口密钥+ R并在运行窗口中输入网址)

- 以下字符串在C#windows应用程序中有效(带有辅助标志和凭证)

string x = @"C:\Program Files (x86)\Skype\Phone\Skype.exe";

1 个答案:

答案 0 :(得分:1)

使用Start(string fileName, string arguments) 并将/secondary /username:myusername /password:mypassword作为参数传递

System.Diagnostics.Process.Start(@"C:\Program Files (x86)\Skype\Phone\Skype.exe",@"/secondary /username:myusername /password:mypassword");