Author |
Topic  |
|
Aznknight
Senior Member
   
USA
1373 Posts |
Posted - 30 March 2001 : 19:23:22
|
Anyone know a way to use visual basic to run a file? I'm trying to run a batch file with a param using vb.
With the File System object, I can read, write, move files just fine, but there's no way to run the file...
I thought of using the shell object to do it, but it's mostly for working with Windows folders among other things. I kinda got it to work by using the Open method of a Shell32.Application object, but the open method was intended for opening folders and not running files. So I can't open a batch file with a param.
And if you're wondering..no i'm not writing a virus hehe..just have windows setup script in batch file that I building a GUI for.
- Alan www.iamviet.com www.calvsa.net Snitz Resource |
|
Doug G
Support Moderator
    
USA
6493 Posts |
Posted - 30 March 2001 : 21:57:26
|
VB6, use Shell
Runs an executable program and returns a Variant (Double) representing the program's task ID if successful, otherwise it returns zero.
Syntax
Shell(pathname[,windowstyle])
The Shell function syntax has these named arguments:
(see the docs for all the gory details)
====== Doug G ====== |
 |
|
Doug G
Support Moderator
    
USA
6493 Posts |
Posted - 30 March 2001 : 22:04:41
|
If you meant vb script, like from an asp page, you can use the windows scripting host (assuming it's installed on your server).
A sample:
strRun = "c:\batch\bat1.bat" Set Wxec = Server.CreateObject("Wscript.Shell") On Error Resume Next RunFile = Wxec.run(strRun) Set Wxec = Nothing
====== Doug G ======
Edited by - Doug G on 30 March 2001 22:05:23 |
 |
|
|
Topic  |
|