See available drives from Windows CLI?
Become or hire the top 3% of the developers on Toptal https://topt.al/25cXVn
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Hypnotic Orient Looping
--
Chapters
00:00 Question
00:25 Accepted answer (Score 167)
00:53 Answer 2 (Score 91)
01:32 Answer 3 (Score 34)
02:02 Answer 4 (Score 13)
02:20 Thank you
--
Full question
https://superuser.com/questions/139899/s...
Answer 2 links:
[reference]: http://www.windows-commandline.com/file-.../
[since win2k]: http://technet.microsoft.com/en-us/libra...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#windows #commandline
#avk47
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Hypnotic Orient Looping
--
Chapters
00:00 Question
00:25 Accepted answer (Score 167)
00:53 Answer 2 (Score 91)
01:32 Answer 3 (Score 34)
02:02 Answer 4 (Score 13)
02:20 Thank you
--
Full question
https://superuser.com/questions/139899/s...
Answer 2 links:
[reference]: http://www.windows-commandline.com/file-.../
[since win2k]: http://technet.microsoft.com/en-us/libra...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#windows #commandline
#avk47
ACCEPTED ANSWER
Score 170
> 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
ANSWER 2
Score 92
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.
ANSWER 3
Score 37
For the sake of completeness, there is yet another way:
fsutil fsinfo drives
which returns:
Drives: C:\ D:\ E:\ F:\
(Not a very scripting-friendly output, but it may be useful for human eye)
Some reference. That should work since win2k but only with Administrator account.
(Thanks @Carlos Campderrós for enhancing the answer)
ANSWER 4
Score 14
If you're using powershell then you can type in
get-psdrive -psprovider filesystem
Edited in response to comments to only show filesystems