程序执行+C#中表单中的参数

本文关键字:参数 表单 程序 +C# 执行 | 更新日期: 2023-09-27 17:58:34

我目前正在尝试执行一个带有C#形式参数的程序

    private void button1_Click_1(object sender, EventArgs e)
    {
        Process.Start("nan.exe");
    }

尽管我正在尝试传递此参数:"nan.exe C:''Windows''System32"

在我的情况下,我怎么能这样做?

程序执行+C#中表单中的参数

使用:

 Process.Start("nan.exe", @"c:'windows'system32");

建议使用Environment.GetFolderPath()。

您可以使用StartInfo对象来完成以下操作:

// where fileName and arguments is what you need:
Process p = new Process();
p.StartInfo = new ProcessStartInfo(@"nan.exe", @"C:'windows'system32");
p.Start();