keep the shell window open


I have a VB.NET program that kicks of a shell. How do I get the shell to not close immediately when it is done?

Should I use something with more options than the Shell command, like ProcessStartInfo, or do I just need to pass in a readline operation with the shell command so that it waits for me to press enter before closing?

LVL 4
brokeMyLegBikingAsked:
Who is Participating?
 
gopinathdeepakConnect With a Mentor Commented:
yeah...

say u want to run the ping command in the shell ..... use the cmd.exe command ahead of the ping command...

i.e.
instead of saying something like..

ping 192.168.101.1 -n 1

run it as

cmd.exe /K ping 192.168.101.1 -n 1...

(the option parameter /K for cmd.exe runs the ping command but keeps the shell open.../C makes it close, but it also the default option i think...)

heres a demonstration using the Process Class...

'==============================
       Dim ps As New Process
        With ps.StartInfo
            .FileName = "cmd.exe"
            .Arguments = "/K ping deepak -n 1"
            .CreateNoWindow = False
        End With
        ps.Start()
        ps.WaitForExit()
        ps.Close()
'==============================

good luck!
0
 
bman9111Commented:
process.start(then program)

ex

process.start("C:\test.exe")


not sure if this was what u are looking for.  the shell command is really for the vb6. Still can use it by process is the vb.net way
0
Question has a verified solution.

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.

All Courses

From novice to tech pro — start learning today.