Link to home
Start Free TrialLog in
Avatar of erikcook
erikcook

asked on

Determining a CDROM Drive LEtter with a variable output to a Batch File.


I have an unattended Windows XP Installation CD. At the end of the installation, I want a program to run that will prompt to insert the Windows 2003 CDROM and press ok. In the background I need it to autodetet the CDROM Drive letter and output it as a variable named %1.

Then it will run a command with the %1 in the command line...   %1:\Office2003\setuppro.exe and launch the setup.


I thought batch or a VBS would be the best way to go, but I dont know how to get the cdrom drive letter to detect and output as a variable.

Im looking for any kind of solution for this issue, wether it be in VB or batch... anything.
Avatar of EDDYKT
EDDYKT
Flag of Canada image

On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalDisk",,48)
For Each objItem in colItems
    Wscript.Echo "Description: " & objItem.Description
    Wscript.Echo "DeviceID: " & objItem.DeviceID
    Wscript.Echo "DriveType: " & objItem.DriveTypeNext


check
ASKER CERTIFIED SOLUTION
Avatar of EDDYKT
EDDYKT
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial