How can I make a vbscript run a .bat file invisibly off a cd?

shrshr429

Solid State Member
Messages
19
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

Solid State Member
Messages
19
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
 
Top