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

map a drive and run a small app with vbscript???

Status
Not open for further replies.

joepc

MIS
Jul 26, 2002
647
US
I have a program that needs to be run via with a login script.

I can do it with just a batch file, but once the program is done running the computer sits with the windows that says please wait while your login script is running with a cancel box. If I hit cancel then the desktop comes up and all is well.

This is what I got.

net use m: \\server\share
m:\program.exe
exit

This program needs to be run every morning for about 4 days and I don't won't to bother/confuse the end users. I also don't want a hundred phone calls. So I contacted the company who makes the software and they said I need to use a vbscript to run the program because once the program is done running it won't proceed with the rest of the batch file because of how win NT and 2000 use their scripting?????

They told me I need to create a vb script to do this.

Does anyone know of a way I can do this with vbscripting?

The name of file I need to run is agent32.exe. It is a pc auditing software program

I don't know a single stinking thing about vbscripting so any help would be greatly appreciated.
 
joepc,

For details on WSH/VBScript go to DevGuru. The following link explains the Run Method of WindowsScriptingHost.

Cut and paste the following between the vv and the ^^^ into NOTEPAD. Save the file with filename.VBS in a place you can find it again. To run it, you would use:

cscript c:\path\filename.vbs

vvvvvvvvv

'Set up Variables
Dim WSHShell
Dim WSHNetwork

'Set up some Objects for use later

Set WSHNetwork = WScript.CreateObject("WScript.Network")
Set WSHShell = WScript.CreateObject("WScript.Shell")

WshNetwork.MapNetworkDrive "m:", "\\server\share"

WshShell.Run("agent32.exe") ' You may need to put in the full path c:\path\agent32.exe

^^^^^^^^^^^^^^^^

Assuming you are NT or Win2000 or WinXP, to trigger the script use either AT or WINAT or Task Scheduler. Click on START / HELP and type in AT or WINAT or Task Schedulr for info or search Google.

Hope this helps.
DougCranston
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top