C# 程序执行+;C中表单的参数#
我目前正试图执行一个带有C形式参数的程序。我的守则如下:C# 程序执行+;C中表单的参数#,c#,.net,windows,C#,.net,Windows,我目前正试图执行一个带有C形式参数的程序。我的守则如下: private void button1_Click_1(object sender, EventArgs e) { Process.Start("nan.exe"); } 尽管我试图传递此参数:“nan.exe C:\Windows\System32” 在我的情况下,如何才能做到这一点?使用: Process.Start("nan.exe", @"c:\windows\system32");
private void button1_Click_1(object sender, EventArgs e)
{
Process.Start("nan.exe");
}
尽管我试图传递此参数:“nan.exe C:\Windows\System32”
在我的情况下,如何才能做到这一点?使用:
Process.Start("nan.exe", @"c:\windows\system32");
建议使用Environment.GetFolderPath()。使用:
Process.Start("nan.exe", @"c:\windows\system32");
建议使用Environment.GetFolderPath()。您可以使用对象来完成此操作:
// where fileName and arguments is what you need:
Process p = new Process();
p.StartInfo = new ProcessStartInfo(@"nan.exe", @"C:\windows\system32");
p.Start();
可以使用对象为您执行此操作:
// where fileName and arguments is what you need:
Process p = new Process();
p.StartInfo = new ProcessStartInfo(@"nan.exe", @"C:\windows\system32");
p.Start();
谢谢,但是否可以使用envorioment变量,如%TEMP%等?是的,传递任何您想要的内容。比如Environment.GetEnvironmentVariable(“TEMP”)@Mike:为此,您需要使用方法
System.Environment.GetEnvironmentVariable()
谢谢,但是可以使用Environment变量,例如%TEMP%等吗?是的,传递您想要的任何内容。比如Environment.GetEnvironmentVariable(“TEMP”)@为此,您需要使用方法System.Environment.GetEnvironmentVariable()