Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
hi !!!
I was wondering if there is some kind of alternative to the %systemdrive% location to point to the cdrom drive
I wrote a .bat to run a install, tested it on my HDD with the line "start /wait %systemdrive%\INSTALL.exe (...)"
but now I want to burn it on a CD-R...or even better, is there a way to point to the location of the .bat, whatever this location is ?? (cdrom, local path, remote path...)
thanks for your help !!!

Hi
Paste this into a Notepad Or similar Text Editor and save as FileName.vbs.
Call using cscript FileName.vbs Or wscript Filename.vbs. You will have To change File To "Path\FileName.bat" To match your location.
Let me know If this works ok as I'm just learning to use VBScript.------------
Dim FSO, SHL
Dim Drive, File
Set FSO = CreateObject("Scripting.FileSystemObject")
Set SHL = CreateObject("WScript.Shell")
'Check drive and file exists
File="Test.bat"
For Each Drive In FSO.Drives
If Drive.IsReady And FSO.FileExists(Drive & File) Then
WScript.echo Drive,"Exists ",Drive & File
SHL.Run Drive & "Test.bat"
End If
Next
--------------

yup, thanks for your abswer !!!
but actually I don't know VBScript at all !!
what is this script supposed to do ?
if it is to be run from my HDD, that's not what I want to do (maybe it wasn't clear in the first place ;-) ).
actually my .bat is on a cd and is pointed at by the autorun file, for instance.
so I needed a kind of "absolute path", not regarding to the drive letter...and, as a matter of fact, just replacing %systemdrive% by %cdrom% worked out pretty good !!
But the first time I tried it I typed it wrong and didn't notice (was late maybe) so I thought it didn't work...but if you explain me what your script is for, I could try it anyway...

Hi
The vbscript checks all the drives on the computer including cdroms dvd's zip dreives ect:
If the file Batch file Test.bat exists on any of these drives in the root directory then its executed.I was thinking that you wanted to run a batch file on a cdrom, but if used on different computers then the drive letters would/might change.
I don't see any problem from running script file from anywhere you like.
If the batch file is in a folder just change File="Folder\Temp.bat" ect:
and the run line would be beter changed from
SHL.Run Drive & "Test.bat" to
SHL.Run Drive & File

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |