【发布时间】:2018-11-09 10:26:00
【问题描述】:
你能找到我的问题吗? 我无法使用正确的参数打开 rasphone.exe。
private void Button_Click_1(object sender, RoutedEventArgs e)
{
System.Diagnostics.ProcessStartInfo proc = new System.Diagnostics.ProcessStartInfo();
proc.FileName = @"C:\windows\system32\cmd.exe";
proc.Arguments = @"C:\Windows\System32\rasphone.exe -d ""My VPN""";
System.Diagnostics.Process.Start(proc);
}
我也试过了:
Process.Start(@"C:\Windows\System32\rasphone.exe", @" -d ""My VPN"" ");
或者:
System.Diagnostics.Process.Start(@"C:\\Users\\***\\Documents\\VPN Launcher\\VPN Launcher\\VPN Launcher\\startVPN.bat");
.bat 文件中:
start "" "C:\Windows\System32\rasphone.exe" -d "My VPN"
它会打开 cmd/.bat,但我没有使用正确的参数打开 rasphone.exe。
【问题讨论】:
-
为什么不直接启动rasphone.exe?之前一定要打通命令行吗?
-
不,但它不起作用。我试过了( Process.Start(@"C:\Windows\System32\rasphone.exe", @" -d ""My VPN"" "); )
-
当您尝试使用该命令行手动启动时,rasphone 是否启动?
-
是的,当我使用批处理文件或通过命令行启动它时它也会启动,但在调试时它不会启动
-
你确定 rasphone 没有启动吗?我的意思是你是否让你的应用程序运行以确保你启动的进程继续运行?
标签: c# visual-studio parameters vpn openprocess