Jump to content

%.....% points to ?


Anon5710

Recommended Posts


Here's a list of a bunch of em:

http://home.earthlink.net/~rlively/MANUALS/ENV/INDEX.HTM

But 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

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

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=%%d
if "%CDROM%"=="" goto EOF

Now you can use %CDROM% as a variable.

Link to comment
Share on other sites

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

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 :blushing: )

Then you can use %~dp0 to start every setup or batch on your cd-rom.

Edited by Godzilla
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...