?
Solved

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

Posted on 2004-11-05
2
Medium Priority
?
352 Views
Last Modified: 2010-05-02

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.
0
Comment
Question by:erikcook
  • 2
2 Comments
 
LVL 26

Expert Comment

by:EDDYKT
ID: 12505042
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
 
LVL 26

Accepted Solution

by:
EDDYKT earned 1000 total points
ID: 12505048
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

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month14 days, 12 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question