Results 1 to 8 of 8
  1. #1
    2 Star Lounger
    Join Date
    Mar 2010
    Location
    Midwest USA
    Posts
    120
    Thanks
    2
    Thanked 2 Times in 2 Posts
    While using the command prompt in Windows 7, is there a way to get a list of the drive letters that have drives? For example, I want to find the USB flash drive on a system without having to try f:, then g:, then h:, etc.

    -JohnO

  2. #2
    New Lounger
    Join Date
    Dec 2009
    Location
    Utah
    Posts
    18
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Give it a volume label, such as JohnUSB.

  3. #3
    Administrator
    Join Date
    Mar 2001
    Location
    St Louis, Missouri, USA
    Posts
    23,571
    Thanks
    5
    Thanked 1,056 Times in 925 Posts
    Quote Originally Posted by John Oliphant View Post
    While using the command prompt in Windows 7, is there a way to get a list of the drive letters that have drives? For example, I want to find the USB flash drive on a system without having to try f:, then g:, then h:, etc.
    You need to run a script. Look around TechNet Script Center Repository. There is likely something there to help.

    Joe
    Joe

  4. #4
    5 Star Lounger
    Join Date
    Dec 2009
    Location
    Milwaukee, WI
    Posts
    737
    Thanks
    23
    Thanked 64 Times in 52 Posts
    Type diskpart at the "C" prompt. This launches the diskpart utility and will change the prompt to look like this: DISKPART> . Diskpart is like disk manager on steroids, just without a GUI. Type "list volume" without the quotes. You'll get a nice list of disks along with drive letters, disk type, and file system. Type "Exit" to leave the utility.
    Chuck

  5. #5
    New Lounger
    Join Date
    Dec 2009
    Location
    Utah
    Posts
    18
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Chuck,

    I was going to edit my previous reply with the info you gave but you beat me to it. This does work, even from the C: prompt.

  6. #6
    5 Star Lounger
    Join Date
    Jan 2010
    Location
    Los Angeles, CA
    Posts
    828
    Thanks
    4
    Thanked 38 Times in 34 Posts
    In PowerShell you can enter:

    get-psdrives -psprovider filesystem

    This shows all the disk drives that are "live".

    If you want to do that from a command prompt:

    powershell get-psdrives -psprovider filesystem

  7. #7
    3 Star Lounger
    Join Date
    Dec 2009
    Location
    Sydney, Australia
    Posts
    254
    Thanks
    0
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by Peter Johnson2191 View Post
    In PowerShell you can enter:

    get-psdrives -psprovider filesystem

    This shows all the disk drives that are "live".

    If you want to do that from a command prompt:

    powershell get-psdrives -psprovider filesystem
    The above is not quite right as I think Peter has made a typo by adding an "s".

    The required cmdlet is "get-psdrive" i.e.

    Code:
    get-psdrive -psprovider filesystem
    Code:
    powershell get-psdrive -psprovider filesystem
    If you would like to get a bit trickier and use WMI+Powershell and only list removable drives you can use this. It is compatible with Windows XP with powershell installed also.

    Code:
    powershell "get-wmiobject Win32_LogicalDisk | ? {$_.drivetype -eq 3} | % {get-psdrive $_.deviceid[0]}"
    Change out the digit in $_.drivetype -eq for your choice of display.

    • 0 - Unknown
    • 1 - No Root Directory
    • 2 - Removable Disk
    • 3 - Local Disk
    • 4 - Network Drive
    • 5 - Compact Disk
    • 6 - RAM Disk

  8. #8
    Super Moderator BATcher's Avatar
    Join Date
    Feb 2008
    Location
    A cultural area in SW England
    Posts
    3,413
    Thanks
    33
    Thanked 195 Times in 175 Posts
    You might look at one of the Sysinternals utilities, PSINFO, which gives you lots of (in this case unnecessary) information about your PC, then the disk information you want. Specify psinfo -d to get the disk infomation appended (no, you can't get it by itself, unfortunately).
    Example output:

    Code:
    Volume Type       Format     Label                      Size       Free   Free
        A: Removable                                                          0.0%
        C: Fixed      NTFS       Dell_C                372.60 GB  349.72 GB  93.9%
        E: Fixed      NTFS       MaxtorExt_E           279.47 GB   97.91 GB  35.0%
        R: CD-ROM                                                             0.0%
        W: CD-ROM                                                             0.0%
    To get DISKPART to work successfully from the Command Prompt in one line, or in a BATch file, do echo list volume | diskpart
    Example output:

    Code:
      Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
      ----------  ---  -----------  -----  ----------  -------  ---------  --------
      Volume 0     R                       DVD-ROM         0 B                     
      Volume 1     W                       DVD-ROM         0 B                     
      Volume 2     C   Dell_C       NTFS   Partition    373 GB  Healthy    System  
      Volume 3     E   MaxtorExt_E  NTFS   Partition    279 GB  Healthy
    (Other DISKPART commands are available!)
    BATcher

    Time prevents everything happening all at once...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •