我有一个运行以下完美的bat文件:
Bec.exe --f=Config.cfg
现在在 vb.net 中,我有一个按钮,可以使用相同的参数启动相同的 exe,并输出到 rtb。但是由于某种原因它没有传递论点,我不知道为什么。任何人都可以帮忙吗?
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
    Dim cmdProcess As Process
    cmdProcess = New Process()
    cmdProcess.StartInfo.FileName = """" & TextBox2.Text & """" 'normally this is C:\ServerTools\Bec.exe
    cmdProcess.StartInfo.Arguments = """" & TextBox1.Text & """" 'normally is --f=Config.cfg
    cmdProcess.StartInfo.RedirectStandardOutput = True
    cmdProcess.StartInfo.UseShellExecute = False
    If cmdProcess.Start() Then
        RichTextBox2.Text = cmdProcess.StandardOutput.ReadToEnd
    Else
        ' Failed to execute
    End If
End Sub
此外,我将为我正在启动的 .exe 提供已接受选项的参考
Options:
-h, --help            show this help message and exit
-f FILENAME, --file=FILENAME