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.
erikcookAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

EDDYKTCommented:
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
0
EDDYKTCommented:
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
Next


End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.