Running a command line program

murrayf1

Member
Joined
May 5, 2006
Messages
21
Programming Experience
1-3
Hi i have a command line program that is run in this format

murray.exe C:\folder\input.txt C:\folder\output.txt

now to make it easier for me when running this file i am trying to make a ui for it

I have found how to locate the file and allow the user to select the output file and dim the filepath and name as strings now how can i get vb to run my program with that those strings ?

I have tried running them as arguments / commands but because this app does not use -input.txt and -output.txt i believe it is the problem
 
Start with building a ProcessStartInfo object and run it with Process class. They are both found in the System.Diagnostics namespace of documentation. The format of the arguments is only dependent on the format requirements of the application to process them, not the process ran by .Net. Example:
VB.NET:
Dim arguments As String = "C:\folder\input.txt C:\folder\output.txt"
Dim PSI As New ProcessStartInfo("murray.exe", arguments)
Process.Start(PSI)
 
Here is the neatest way I can think of to accomplish the entire operation:
VB.NET:
Using ofd As New OpenFileDialog
    ofd.Title = "Select Input File"

    If ofd.ShowDialog() = Windows.Forms.DialogResult.OK Then
        Using sfd As New SaveFileDialog
            sfd.Title = "Select Output File"

            If sfd.ShowDialog() = Windows.Forms.DialogResult.OK Then
                Process.Start("murray.exe", ofd.FileName & " " & sfd.FileName)
            End If
        End Using
    End If
End Using
 
:-( both of those methods dont work the application waits for ages the an error HLVDD - Hardlock Virtual Device Driver cannot befound
 
Back
Top