Jump to content

CD driveLetter


idanlerer

Recommended Posts

Hi,

Is there any option in windows pe to get the drive letter of the CD-ROM ?

I would like to create batch file that need access to the CD-ROM but I don't know what is the CD-ROM drive letter (it's not the X since I not place in the mount folder)

Link to comment
Share on other sites


Usually a small batch file checkong the existance of a "tag file" (i.e. a file that you know is ONLY on the CD) is used, an example is here:

http://www.msfn.org/board/index.php?showtopic=38739

A more elaborate example of batch can be found here:

http://www.robvanderwoude.com/amb_cdrom.html

(that can detect a CD ROM even if no media is in it)

And here is a .vbs example:

http://www.robvanderwoude.com/files/cdrom_vbs.txt

Though I did not understand:

(it's not the X since I not place in the mount folder)

could you please better explain the above.

jaclaz

Link to comment
Share on other sites

Here is what I've come up with for my ghost restore disks that use a WinPE boot. I have a HTA menu solution so its in vbscript.

'Globals
Dim objShell, objFso, cdrom
Set objShell = CreateObject("WScript.Shell")
Set objFso = CreateObject("Scripting.FileSystemObject")

Sub findCD
Dim collSettings, objItem, lword

'determine cd-rom drive letter
objShell.Run "%comspec% /c diskpart /s X:\Windows\system32\probeDrives.txt",0,true
Set collSettings = objFso.Drives
For Each objItem in collSettings
If objItem.DriveType = 4 Then
lword = objItem.DriveLetter
If objFso.FileExists(lword & ":\sources\boot.wim") Then
cdrom = lword & ":"
Exit For
End If
End If
Next

'check whether cdrom was set
If cdrom = "" Then
MsgBox "Could not determine CD-ROM drive letter",16,"Error"
End If
End Sub

probeDrives.txt:

rescan
exit

I've found that if you have an external CD/DVD drive it doesn't always pick up the drive, so the probeDrives diskpart script ensures that all drives are accounted for before you look for the drive. boot.wim is the jellybean I look for on the drive since I always use a PE boot.

Link to comment
Share on other sites

  • 3 months later...

Hello,

First of all, I just wanted to say thanks to you guys for putting forth the time and effort to write and post your tools!

I am looking to use the newer WinPE 2.0 for image deployment, and this is exactly the issue I need help to tackle. I came across this, and the DetectDrive thread, but I haven't been able to get either to work within this environment. I have the Scripting package installed in PE, but nothing else (do I need something else?)...

The DetectDrive program seems to do nothing, as in, the help file won't even pull up and the script doesn't seem to do anything either.

Opening a new cmd window to run Set gives no new variable in either case. I am not necessarily new to batch files/command prompt/scripting, but I am not an expert either.

Can you guys offer any further suggestions?

Thanks,

David

Link to comment
Share on other sites

I don't have it here in front of me but in a recent Technet article they said under certain circumstances you need to install an additional component to your PE build. It seems to me it was MDAC but it could have been XML. Try adding those, or all of them and see what happens.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...