私は以下を完全にうまく実行する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