L
Lloyd Sheen
I am trying to keep the process window open when I do the following:
Open a process with "cmd.exe"
Code is:
Dim myProcess As Process = New Process()
Dim s As String
myProcess.StartInfo.FileName = "cmd.exe"
myProcess.StartInfo.WorkingDirectory = "C:\Lloyds Music\Blues On
C\Beverley Skeete - Unchained"
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.CreateNoWindow = False
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
myProcess.StartInfo.RedirectStandardInput = True
myProcess.StartInfo.RedirectStandardOutput = False
myProcess.StartInfo.RedirectStandardError = False
myProcess.Start()
Dim sIn As StreamWriter = myProcess.StandardInput
sIn.Write("dir /s" + Environment.NewLine)
myProcess.WaitForExit()
The actual work I will do will be different, this is only for testing to get
the process correct.
I do this and I can see the command window open and close. The WaitForExit
just falls thru since the process is complete. How do I keep the window
open after the commands I send complete?
I did try and add the following line:
sIn.Write("Pause" + Environment.NewLine)
but it did not make any difference.
Thanks
LS
Open a process with "cmd.exe"
Code is:
Dim myProcess As Process = New Process()
Dim s As String
myProcess.StartInfo.FileName = "cmd.exe"
myProcess.StartInfo.WorkingDirectory = "C:\Lloyds Music\Blues On
C\Beverley Skeete - Unchained"
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.CreateNoWindow = False
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
myProcess.StartInfo.RedirectStandardInput = True
myProcess.StartInfo.RedirectStandardOutput = False
myProcess.StartInfo.RedirectStandardError = False
myProcess.Start()
Dim sIn As StreamWriter = myProcess.StandardInput
sIn.Write("dir /s" + Environment.NewLine)
myProcess.WaitForExit()
The actual work I will do will be different, this is only for testing to get
the process correct.
I do this and I can see the command window open and close. The WaitForExit
just falls thru since the process is complete. How do I keep the window
open after the commands I send complete?
I did try and add the following line:
sIn.Write("Pause" + Environment.NewLine)
but it did not make any difference.
Thanks
LS