Anon5710 Posted September 18, 2005 Share Posted September 18, 2005 Hello Ik know that %systemroot% points to :\windows and that %systemdrive% points at c:\ (if you windows instalation is located there)BUT is there a %******% that points at cd-rom drive ?It would make my life somwhat easier Link to comment Share on other sites More sharing options...
InTheWayBoy Posted September 18, 2005 Share Posted September 18, 2005 Here's a list of a bunch of em:http://home.earthlink.net/~rlively/MANUALS/ENV/INDEX.HTMBut you won't find any CD variable in their. You can do a little scripting and set one up though. Most of the time people have the script find a certain file that is on the cd, and then script will bind whatever drive letter it finds to the CD variable you make. You have to check all the drives, as a CD could be anything. I don't use that though, so I don't have any code for you. I'm sure someone here will. Link to comment Share on other sites More sharing options...
gunsmokingman Posted September 18, 2005 Share Posted September 18, 2005 Here A Vbs Script that checks to see if the CD or DVD drive has a disk in it. If a disk is in the drive then it popup a message with some basic info. If there is not a disk in the CD or DVD drive it popup a message that it missing. Dim Act, Fso, Drv, strDrive Set Act = CreateObject("Wscript.shell") Set Fso = CreateObject("Scripting.FileSystemObject") Set Drv = Fso.Drives For Each strDrive In Drv If strDrive.DriveType = 4 Then If strDrive.IsReady = True Then Act.Popup strDrive.VolumeName & vbCrLf & strDrive.DriveLetter & ":\" &_ vbCrLf & strDrive.IsReady,5,"CD Rom Info",0 + 32 Else Act.Popup "The CD Or DVD Does Not Appear Ready" & vbCrLf &_ strDrive.DriveLetter & ":\", 5, "Missing CD", 0 + 32 End If End If next Link to comment Share on other sites More sharing options...
Asin Posted September 18, 2005 Share Posted September 18, 2005 I've used %CDROM% successfully in VMware before. Link to comment Share on other sites More sharing options...
mywindow Posted September 19, 2005 Share Posted September 19, 2005 If looking to use the CDROM in a batch file here is the easiest option that does not require another .EXE file.This batch script looks for a unique file on a drive (win51ip.SP2 from the XPSP2 CD) and sets that drive as a variable %CDROM%for %%d in (D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%d:\win51ip.SP2 set CDROM=%%dif "%CDROM%"=="" goto EOFNow you can use %CDROM% as a variable. Link to comment Share on other sites More sharing options...
InTheWayBoy Posted September 19, 2005 Share Posted September 19, 2005 That's the code...I've seen that in a ton of batch files, seems to work just fine. As per the %CDROM% usage in VMWare, that's very curious...there isn't a default variable for that, maybe you had the same kinda script running elsewhere that set that up for you. Link to comment Share on other sites More sharing options...
Asin Posted September 19, 2005 Share Posted September 19, 2005 Well, what I had was a SP2 update CD with the post-SP2 updates on them for a few home users that had computers.I did a fresh install of a XP with SP1 in VMware so that I could test it out before I rolled out the CDs to the home users. The batch files seemed fine. Link to comment Share on other sites More sharing options...
Godzilla Posted September 20, 2005 Share Posted September 20, 2005 (edited) You can use these variable in a batch-file.%~d0 - driveletter of current batch ("D:")%~p0 - path of current batch ("\progs\install")%~dp0 - driveletter and path ("D:\progs\install")%~n0 - name of current batch (without path or extention) (D:\patch\setup.bat: "setup")So you only need to create the %cdrom%-varible one time and start a batch on your cd-rom. (my english )Then you can use %~dp0 to start every setup or batch on your cd-rom. Edited September 20, 2005 by Godzilla Link to comment Share on other sites More sharing options...
Zxian Posted September 20, 2005 Share Posted September 20, 2005 @Godzilla - Wow... that's handy! Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now