Run DOS Commands Without DOS Window Popping Up

Run DOS Commands Without DOS Window Popping Up

Post by Jason Mos » Sun, 20 Jun 2004 03:19:41


These lines of code:

Imports System.Diagnostics.Process
Start("subst I: D:\FakeFolder1")

Will start the DOS command subst, but the problem is the DOS window will
popup temporarily. This looks unprofessional in my application, and I was
wondering how I could stil run the command without the DOS window.

-Jason
 
 
 

Run DOS Commands Without DOS Window Popping Up

Post by Jason Mos » Sun, 20 Jun 2004 03:27:02

These lines of code:

Imports System.Diagnostics.Process
Start("subst I: D:\FakeFolder1")

Will start the DOS command subst, but the problem is the DOS window will
popup temporarily. This looks unprofessional in my application, and I was
wondering how I could stil run the command without the DOS window.

-Jason

 
 
 

Run DOS Commands Without DOS Window Popping Up

Post by Greg Youn » Sun, 20 Jun 2004 03:40:05

redirect standard in/out/error ...

example:

Sub Main()
Const Path = "C:\WINNT\System32\ftp.exe"

Const Args = "hostname"

Dim P As New Process

Dim strOut As String

P.StartInfo.UseShellExecute = False

P.StartInfo.RedirectStandardOutput = True

P.Start(Path, Args)

strOut = P.StandardOutput.ReadToEnd()

Debug.Write(strOut)

P.WaitForExit()

P.Close()

End Sub
 
 
 

Run DOS Commands Without DOS Window Popping Up

Post by hirf-spam- » Sun, 20 Jun 2004 04:21:40

* "Jason Moss" < XXXX@XXXXX.COM > scripsit:

<URL: http://www.yqcomputer.com/ ;

--
Herfried K. Wagner [MVP]
<URL: http://www.yqcomputer.com/ ;
 
 
 

Run DOS Commands Without DOS Window Popping Up

Post by Jason Mos » Sun, 20 Jun 2004 05:13:21

In Greg Young's post, would the variable strOut be the output from the
command (In that case, FTP.exe?)
 
 
 

Run DOS Commands Without DOS Window Popping Up

Post by Greg Youn » Wed, 23 Jun 2004 05:51:55

yes it would be although for a "real" situation you would most likely want
to use threads to actively read/write the other program.






was