Jump to content
Sign in to follow this  

List volume letters to your command window

Recommended Posts


I work in WinPE a bit.

Lots of times I find myself running diskpart just to "list volume" information in the command box, but all I really want is to see which letter was assigned to my "utility" disk (which is either a flash drive or a USB hard disk). Sometimes I do this from a DVD, and sometimes I've booted from a different flash or USB drive.

So I made a quick tool that types the information out to the DOS box. You don't have to compile for x64 in most cases, but a Windows PE image that is made x64 cannot support 32-bit executables...

I'm not even sure such a strange tool is useful to anyone else. :P

And for sure some types of mounted network drives may not show up (e.g., ClearCase volumes...)


#include <array.au3>

Global $aFixedInfo[1]
Global $aRamInfo[1]
Global $aRemoveableInfo[1]

$aCDROM = DriveGetDrive("CDROM")
$aFIXED = DriveGetDrive("FIXED")
$aNETWORK = DriveGetDrive("NETWORK")
$aRAMDISK = DriveGetDrive("RAMDISK")
$aUNKNOWN = DriveGetDrive("UNKNOWN")

If IsArray($aCDROM) Or IsArray($aREMOVABLE) Or IsArray($aFIXED) Or IsArray($aNETWORK) Or IsArray($aRAMDISK) Or IsArray($aRAMDISK) Or IsArray($aUNKNOWN) Then
    Send("Retrieving volume info.....")
    Send("There was a problem retrieving volume letter info!")

If IsArray($aUNKNOWN) Then
    $sUNKNOWN = StringTrimLeft(_ArrayToString($aUNKNOWN, " "), 2)
    Send("Unknown drive types: " & $sUNKNOWN)

If IsArray($aNETWORK) Then
    $sNETWORK = StringTrimLeft(_ArrayToString($aNETWORK, " "), 2)
    Send("Network drives: " & $sNETWORK)

If IsArray($aCDROM) Then
    $sCDROMList = StringTrimLeft(_ArrayToString($aCDROM, " "), 2)
    Send("CD drives: "& $sCDROMList)

If IsArray($aRAMDISK) Then
    For $i = 1 To $aRAMDISK[0]
        $sLbl = DriveGetLabel($aRAMDISK[$i])
        _ArrayAdd($aRamInfo, $aRAMDISK[$i] & '(' & $sLbl & ')')
    $sRAMDISK = StringTrimLeft(_ArrayToString($aRamInfo, " "), 1)
    Send("RAM disks: " & $sRAMDISK)

If IsArray($aREMOVABLE) Then
    For $i = 1 To $aREMOVABLE[0]
        $sLbl = DriveGetLabel($aREMOVABLE[$i])
        _ArrayAdd($aRemoveableInfo, $aREMOVABLE[$i] & '(' & $sLbl & ')')
    $sREMOVABLE = StringTrimLeft(_ArrayToString($aRemoveableInfo, " "), 1)
    Send("Removeable drives: " & $sREMOVABLE)


If IsArray($aFIXED) Then
    For $i = 1 To $aFIXED[0]
        $sLbl = DriveGetLabel($aFIXED[$i])
        _ArrayAdd($aFixedInfo, $aFIXED[$i] & '(' & $sLbl & ')')
    $sFIXED = StringTrimLeft(_ArrayToString($aFixedInfo, " "), 1)
    Send("Fixed disks: "& $sFIXED)

Func _doBreak()
EndFunc   ;==>_doBreak

Share this post

Link to post
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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.