Go Back   Computer Forums > General Computing > Hardware
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 07-08-2009, 02:18 AM   #1
Solid State Member
 
Join Date: Jun 2009
Posts: 19
Default How can I make a vbscript run a .bat file invisibly off a cd?

I made a .bat file that disconnects you from the internet, and i also made a vbscript that will make this file run in invisible mode. The problem is when vbscript runs automatically from a cd the location of the file changes so it doesnt work.

Heres an example, lets say i burn the .bat file and the vbscript on a cd.
When i make the vbscript i write the location of the .bat in cd drive D.
Now if i put the cd in cd drive E, the vbscript won't run.

Is there anyway to make the vbscript look for the .bat is any drive?
Or make it so the vbscript doesn't display the error when it doesn't find the .bat file?

In a .bat file i can write %cdrom% instead of the cd drive, is there something similar to that in vbscript.
__________________

shrshr429 is offline   Reply With Quote
Old 07-08-2009, 06:58 AM   #2
Daemon Poster
 
Join Date: Jun 2004
Posts: 511
Send a message via AIM to Denthúl Send a message via MSN to Denthúl Send a message via Yahoo to Denthúl
Default Re: How can I make a vbscript run a .bat file invisibly off a cd?

This page might help you. You'd have to get the script to find the drive letter first and assign it to a variable, then tell the script to run the batch file from the drive letter contained within that variable.

I know very little about VBScript, so I can't do more than provide you with this.

http://www.msfn.org/board/lofiversio...p/t112548.html
__________________

Denthúl is offline   Reply With Quote
Old 07-08-2009, 12:10 PM   #3
Solid State Member
 
Join Date: Jun 2009
Posts: 19
Default Re: How can I make a vbscript run a .bat file invisibly off a cd?

Do you know of a way to make that vbscript invisible, the one that is look for the drive?

Got it:

On Error Resume Next
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "D:\Disconnect.bat" & Chr(34), 0
Set WshShell = Nothing
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "E:\Disconnect.bat" & Chr(34), 0
Set WshShell = Nothing
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "F:\Disconnect.bat" & Chr(34), 0
Set WshShell = Nothing
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "G:\Disconnect.bat" & Chr(34), 0
Set WshShell = Nothing
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "H:\Disconnet.bat" & Chr(34), 0
Set WshShell = Nothing
shrshr429 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 10:01 PM.


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