At the moment i am using the shell command simply because i need to the my program as if it was a batch file, the program that im using needs the shell command to run properly otherwise it would need to be done in a batch file, now i know process.start as allot more flexibility and i need to know if i can run a program using process.start and still run it as if it was running from a shell command. Anybody know how to solve this?

Solved: i used process.start(shell("PROG.EXE"))

9 Years
Discussion Span
Last Post by bartj1


This this:

' 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.
Return retStr

End Function




Can you recommend a method that would allow me to obtain the output of a process while it was active vs only obtaining the output after the process has exited?


This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.