Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run a command in a dos window via VB6 1

Status
Not open for further replies.

edasonba

Technical User
Apr 20, 2004
1
GB
I would like to run specific command in a DOS window from my VB6 application. How do I do this?

The command I normally enter into the DOS window actually runs another application to solve a specific problem. The dos window then closes on completion.

Many thanks in advance.

edasonba
 
Hi and welcome to Tek-Tips. To get the best from the forum, please read faq222-2244.

For this question, you can shell to a new cmd shell, and run any dos commands:

Shell ("cmd /c copy c:\fred.txt c:\C.txt")

If you go to a Command prompt window and type "cmd /?" (without the quotes) you will get a full parameter list for the cmd instruction


________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
If you use
Shell("cmd /c what...")
then the window will not always close buy it self
Shell("what...")
ex. Shell("copy *.* c:\")
will always close the command window when it finnished it's processing
 
...Hence my reference to the "cmd /?"....

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top