Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 run a file using vb
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Aznknight
Senior Member

USA
1373 Posts

Posted - 30 March 2001 :  19:23:22  Show Profile  Send Aznknight an AOL message  Send Aznknight an ICQ Message
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  Show Profile
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
======
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 30 March 2001 :  22:04:41  Show Profile
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
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.24 seconds. Powered By: Snitz Forums 2000 Version 3.4.07