DOS Commands
-
Hi, How to execute DOS commands from VB. I used Shell command but it didn't work.Pls help me with an example. Ram
VB6 or VB.NET ? What commands are you trying to execute ? Christian Graus - Microsoft MVP - C++
-
Hi, How to execute DOS commands from VB. I used Shell command but it didn't work.Pls help me with an example. Ram
Well, if you just want to execute the commands and exit the command line, you can shell cmd with the /c command line switch. For example, if you want to execute the help command,:
Shell("cmd.exe /c help")
That would work in both VB6 and VB 05, though it's not the best practice in VB 05... Yuvi Panda T 15 Year old Microsoft Student Partner Blogs at : http://yuvipanda.blogspot.com
-
Hi, How to execute DOS commands from VB. I used Shell command but it didn't work.Pls help me with an example. Ram
-
Hi, How to execute DOS commands from VB. I used Shell command but it didn't work.Pls help me with an example. Ram
I always use Process, you can actually redirect the input/output... short example to ping google... Dim ping As New Process ping.StartInfo.Arguments = "www.google.com" ping.StartInfo.CreateNoWindow = True 'this will prevent a window from being created, so the user won't see a flash of a console window opening/closing ping.StartInfo.FileName = "ping" 'whatever program you want to run ping.StartInfo.RedirectStandardOutput = True ' must be set to true if you want to get output ping.StartInfo.UseShellExecute = False ' must be set to false if any of RedirectStandard* members are true ping.Start() 'starts the application MsgBox(ping.StandardOutput.ReadToEnd) 'will msgbox the output of ping