How to run a command of MS DOS with code through visual basic 6.0
for ex. setting the path, zip and unzip files etc.
and also the commands of Visual Foxpro Databasese through VB.

Dim oWSH
Dim cmdDOS As String
Set oWSH = CreateObject("WScript.Shell")
cmdDOS = "cmd.exe /c "
cmdDOS = cmdDOS & "DIR *.*"
oWSH.Run cmdDOS, 1
'Change the 1 to 0 if you don't want to see the dos window

What if I need solution which opens cmd and then I need to send command to it, wait for it to be done, pick results and tings like that, but more than once? I think it's stupid to open and close every time whit shell. Is there smarter solution?
I would appreciate any kind of help. Thanks

Sashka, please read our posting rules. This is a very old post that has just been raised from the dead. This is however your first post, so no harm no foul.

Shell is still the shortest and quickest route to interact with cmd. Read the link belkow for more options on how to only minimize and not close cmd, how to send different commands etc stc.

Hope this puts you on the right track...

http://msdn.microsoft.com/en-us/library/d5fk67ky
This is also a nice one with plenty code samples using cmd...

http://www.dreamincode.net/forums/topic/17098-running-command-prompt-in-

This article has been dead for over six months. Start a new discussion instead.