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

Comments

Please log in to comment

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

Answers

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
Answered 06/17/2009 by: dvdzonenz
Purple Belt

Please log in to comment
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.
Answered 06/17/2009 by: JEBO
Senior Yellow Belt

Please log in to comment
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
Answered 06/17/2009 by: Pudsey
Senior Yellow Belt

Please log in to comment
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:

Answered 08/07/2009 by: Ace
Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity