Script for determining the drive letter of the CD on Windows PE 2.1
HI
I created a CD of Windows PE 2.1 so that, when it is started, it is loaded into virtual drive X.
Now, I want a script that, if it runs on any computer, determine the drive letter of the CD.
THANKS
BYE
I created a CD of Windows PE 2.1 so that, when it is started, it is loaded into virtual drive X.
Now, I want a script that, if it runs on any computer, determine the drive letter of the CD.
THANKS
BYE
0 Comments
[ + ] Show comments
Answers (4)
Please log in to answer
Posted by:
dvdzonenz
15 years ago
Posted by:
JEBO
15 years ago
Hi!
Here is a script that you can use:
for /f "tokens=3 delims=\:" %%k in ('reg query hklm\system\mounteddevices^|find "5C003F00"') do set CDROM=%%k:
This will give you a variable called %CDROM%, the script do not care about which letter has been assigned to the CD/DVD it will instead use a variable.. I have not tested the script on computers with multiple drives, but it works perfectly on single cd-drives computers.
Here is a script that you can use:
for /f "tokens=3 delims=\:" %%k in ('reg query hklm\system\mounteddevices^|find "5C003F00"') do set CDROM=%%k:
This will give you a variable called %CDROM%, the script do not care about which letter has been assigned to the CD/DVD it will instead use a variable.. I have not tested the script on computers with multiple drives, but it works perfectly on single cd-drives computers.
Posted by:
Pudsey
15 years ago
Have used the following with great success:
As with JEBOs post I have not tested the script on computers with multiple drives.
Hope this helps
Puds
'Get the CD Rom letter via WMI
Set colItems = objWMIService.ExecQuery("Select Drive from Win32_CDROMDrive")
If colItems.Count > 0 Then
For Each objItem In colItems
strCDDrive = objItem.Drive
Next
Else
'If we could not resolve the CD/DVD drive, then ask the user
strCDDrive = InputBox("Optical Drive could not be found, please specify drive letter: ", "CD/DVD Drive Letter","D:")
End If
As with JEBOs post I have not tested the script on computers with multiple drives.
Hope this helps
Puds
Posted by:
Ace
15 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.