How can I tell VB to run a batch file

Acccessme

Baseband Member
Messages
26
Hi everyone,

I am trying to write a VB form and I want to put some code behind a button. That will run a Batch file. Now this form will start when a CD is loaded so I need to be able to look aat the drive from where the CD Is loaded.

Any help would be appreciated.
 
you'll find that the program you write will be launched from the CD, so you should be able to just run the batch file on a relative path.

to run a batch file just use this code.

dim errcode as double
errcode = shell(batchfile.bat, vbminimized)
 
Root,

I really appreciate the help it works great. May I ask another question I have a button that it should bring explorer but I want to show what is on the CD. Right now when i click on it it opens explorer but it shows waht is in My Documents folder. this is the code i have right now:
Dim fsoX As Scripting.FileSystemObject
Dim strX As String
Set fsoX = New Scripting.FileSystemObject
strX = fsoX.GetSpecialFolder(0).Path
strX = fsoX.BuildPath(strX, "\Explorer.exe")
Shell strX, vbNormalFocus

Again thanks for the help
JAC
 
Back
Top Bottom