/build/static/layout/Breadcrumb_cap_w.png

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

0 Comments   [ + ] Show comments

Answers (4)

Posted by: dvdzonenz 14 years ago
Purple Belt
0
determining the drive letter of the CD on Windows PE

In vb you can use app.path maybe and take the first string from a program.
HTH
Posted by: JEBO 14 years ago
Senior Yellow Belt
0
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.
Posted by: Pudsey 14 years ago
Senior Yellow Belt
0
Have used the following with great success:

'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 14 years ago
Yellow Belt
0
Here's another script. Assuming the file below is unique to your WinPE disc it will even work with multiple drives.

@echo off
set tagfile=\Windows\wdsmcast.exe
for %%i in (c 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 "%%i:%tagfile%" set CDROM=%%i:

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ