Reputation: 241
I have a simple question that i haven't been able to find the answer to. I have a cmd line program (tap). i have set the path in the environment variable so i can run it from the cmd prompt without issue.
it looks like this:
tap -u load file1 file2
how do i run this via button click in vb.net?
Here's what i have so far...
Private Sub Flash_Click(sender As Object, e As EventArgs) Handles flashBundle.Click
'If (String.Compare(imageTextBox.Text, "") <> 0) And (String.Compare(radioTextBox.Text, "") <> 0) Then
Dim pi As New ProcessStartInfo("C:\p4\main\armos\common\tools\tap.exe")
pi.WorkingDirectory = "C:\p4\main\armos\common\tools\"
pi.Arguments = ("-u load " + imageTextBox.Text + " " + radioTextBox.Text)
Process.Start(pi)
'End If
End Sub
The cmd window flashes and the program doesn't execute.
Thanks in advance.
Upvotes: 1
Views: 3154
Reputation: 19469
Set
pi.UseShellExecute = True
If you want to launch this process via command line. The way you are doing it now is launching it like you were double clicking it.
Kind of related - stackoverflow.com/q/2382683/16391
Upvotes: 2