如何在C#中的Process.Start中处理带空格的值

Mic*_*ael 5 .net c# windows

我有一个按钮,我点击它时使用Process.Start,虽然我从textBox1.Text中选择数据.

虽然如果textBox1.Text中有空格,textBox1.Text上的这些数据仍然无法正常显示

例如textBox1.Text = testing_123有效

虽然textBox1.Text =测试1 2 3不起作用(它只包括"测试")

代码如下:

    private void button19_Click(object sender, EventArgs e)
    {
        Process.Start("test.exe", textBox1.Text);
    }
Run Code Online (Sandbox Code Playgroud)

Teo*_*gul 4

在传递之前简单地引用这样的参数:

private void button19_Click(object sender, EventArgs e)
{
    Process.Start("test.exe", "\"" + textBox1.Text + "\"");
}
Run Code Online (Sandbox Code Playgroud)