Go Back   Computer Forums > Web Design | Website Development > Web Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 05-03-2005, 07:09 PM   #1
Solid State Member
 
Join Date: Jun 2004
Posts: 11
Question How can I tell VB to run a batch file

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.
__________________

Access2mex is offline   Reply With Quote
Old 05-04-2005, 05:59 AM   #2
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 7,999
Default Re: How can I tell VB to run a batch file

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 is offline   Reply With Quote
Old 05-04-2005, 11:22 AM   #3
Solid State Member
 
Join Date: Jun 2004
Posts: 11
Default Re: How can I tell VB to run a batch file

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
Access2mex is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 05:45 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0