Experts Exchange connects you with the people and services you need so you can get back to work.
' Executes and waits for DOS command to complete
Private Function ExecuteDOSCmd(ByVal exe As String, _
Optional ByVal args As String = "") As String
' The string to return to the caller returned from the executed program
Dim retStr As String = ""
' The process that will that will start when the start command is executed
Dim p As New Process()
' The program to be started
p.StartInfo.FileName = exe
' Any arguments that the program needs
If args <> "" Then p.StartInfo.Arguments = args
' Do not use the system shell to start the program this is so we can
' hide the command dos window
p.StartInfo.UseShellExecute = False
' So we can get the data output from the program we are calling
p.StartInfo.RedirectStandardOutput = True
' Show no dos window
p.StartInfo.CreateNoWindow = False
' Start the program
' Read the output from the program we started
retStr = p.StandardOutput.ReadToEnd()
' Wait until the program to exit.
Open in new window
Sub Main(ByVal args() As String)
Dim i As Integer
While i < args.Length
Console.WriteLine(i.ToString() & ": " & args(i))
i = i + 1
Be seen. Boost your question’s priority for more expert views and faster solutions
Public Sub main()
Dim frm As New Form1
Dim str() As String
Dim args() As String = Split(Command$," ")
If (UBound(str) >= 0) Then
a = str(0).ToString
b = str(1).ToString
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.
Premium members get this course for $159.20.
Premium members get this course for $167.20.
Premium members get this course for $108.00.
Premium members get this course for $259.00.
Premium members get this course for $37.50.
Premium members get this course for $18.75.
Premium members get this course for $95.20.
Premium members get this course for $148.75.