Is there a way to list the available drives from cmd.exe ? (Other than manually typying

c:
d:
...

and seeing which ones return errors)

link|improve this question

78% accept rate
feedback

4 Answers

up vote 1 down vote accepted
> wmic logicaldisk get caption

Caption
C:
D:
E:

if probably the easiest one. Doesn't need administrative privileges, doesn't return more or less than what's needed, etc.

If you want to use it in a script, then wrap it in for /f with the skip=1 option:

for /f "skip=1 delims=" %%x in ('wmic logicaldisk get caption') do @echo.%%x
link|improve this answer
A whole bunch of nice tricks! Nice! – Cristi Diaconescu May 30 '10 at 21:30
feedback

If you're in Command Prompt:

diskpart

then

list volume

sample output:

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0     E                       DVD-ROM         0 B  No Media
  Volume 1         System Rese  NTFS   Partition    100 MB  Healthy    System
  Volume 2     C   System       NTFS   Partition     99 GB  Healthy    Boot
  Volume 3     F   Data (local  NTFS   Partition    365 GB  Healthy

and finally

exit

to return to the command line.

link|improve this answer
in contrast to the net use command, this will only list local physical drives. (i think.) see diskpart at technet and diskpart at support.microsoft.com – quack quixote May 11 '10 at 12:33
diskpart needs administrative privileges. If you just want a list of drive letters that's a bit much to ask for ... – Joey May 11 '10 at 13:30
feedback

net use will list all of the network drives attached.

link|improve this answer
feedback

If you're using powershell then you can type in

get-psdrive -psprovider filesystem

Edited in response to comments to only show filesystems

link|improve this answer
That will also return other non-filesystem drives that are mounted, such as Cert:, Alias: and Function:. Furthermore, it will return other file-system directories mounted as a PSDrive (such as Home: for %UserProfile% for me). – Joey May 11 '10 at 13:31
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.