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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you run a DOS or BATCH file from VB6 code? 1

Status
Not open for further replies.

SWilliams15

Programmer
Dec 28, 2000
14
US
How do you run an exe program or launch a .BAT file from within your VB6 program?

Thanks,
Sean
 
SWilliams15,

Here is a pretty simple way of doing what you asked.
Code:
Private Sub cmdExplore_Click()
Dim myApp
myApp = Shell("c:\windows\explorer.exe", 1)
End Sub

The one (1) sets the window state in which it opens. There are several options, such as vbHide, vbMinimize, vbMaximize, etc.

Hope this helps.

tbuch
 
tbuch, thanks. after about 2 hours in MSDN, late into the night, i stumbled across the shell command and your post confirmed it. i was looking for run, execute, and a bunch of other stuff before i finally found an article that talked about running dos apps in VB. i'm glad it's so straightforward that they (MS) figuered minimal documentation was needed. thanks again.
 
to Run DOS file in invisible mode - the user will not see the DOS window

' vbHide parameter will cause the DOS environment to run in invisible mode.
Shell ("command.com /c c:\windows\arp.exe"), vbHide
Eric De Decker
vbg.be@vbgroup.nl

Licence And Copy Protection AxtiveX.

Download Demo version on my Site:
Promotions before 02/28/2001 (free source codebook),visite my site
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top