1

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.

2
  • Did you wrote the tap program? if yes, my suggestion is to add a readLine at the end of it so the cmd window will not flash and you will be able to see the output.. Commented Feb 28, 2013 at 17:06
  • @udidu unfortunately i did not write it and it is an executable. My first thought was to open it and add a 'Pause' to the end of the file, if it were a standard batch file. Commented Feb 28, 2013 at 17:55

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

1 Comment

@StingyJack...Thank You! Exactly what i needed!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.