中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-15 11:34
47,813 topics / 349,903 posts / today 1 new / 48,257 members
DOS疑难解答 & 问题讨论 (解答室) » How to use DOS commands to view all drive letters of this computer? Count the number of drive letters?
Printable Version  5,595 / 8
Floor1 cao7113 Posted 2008-05-06 12:15
初级用户 Posts 19 Credits 50
RT, how to use DOS commands to view how many hard disk drives the computer running the DOS command has, asking experts for the answer. Contact: sdcrj@sina.com, thank you!
Floor2 joyn Posted 2008-05-06 14:09
中级用户 Posts 105 Credits 280 From 广西
@echo off
title Query Drive Letters
color 0a
mode con lines=15
echo strComputer = "." > ./disk.vbs
echo Set objWMIService = GetObject("winmgmts:\\" ^& strComputer ^& "\root\cimv2") >> ./disk.vbs
echo Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalDisk",,48) >> ./disk.vbs
echo For Each objItem in colItems >> ./disk.vbs
echo WScript.Echo objItem.Description^&"="^& objItem.DeviceID >> ./disk.vbs
echo Next >> ./disk.vbs
cscript ./disk.vbs
echo.
echo.
echo Press any key to exit.....
pause >nul
exit
Floor3 cao7113 Posted 2008-05-07 11:35
初级用户 Posts 19 Credits 50
Haha, it must be achievable using other means. Thanks for your sharing!

But personally, I still want to get a pure DOS solution. DOS is called Disk Operating System. Theoretically, this function should be achievable. Maybe there are fewer internal materials in DOS, so this function seems difficult to achieve in our view.

Maybe this problem is really not easy to solve, but fortunately, it can make us think more deeply during our usual study!
Thanks!
Floor4 joyn Posted 2008-05-07 13:09
中级用户 Posts 105 Credits 280 From 广西
If you think of sharing, come on~~ I haven't found the relevant command yet
Floor5 clong Posted 2008-05-07 22:03
初级用户 Posts 54 Credits 121
Pure DOS commands, that is, commands running in DOS 7.1? This is a bit difficult...
Floor6 gmy Posted 2008-05-07 22:51
版主 Posts 392 Credits 1,113
Under pure DOS, I have 5 tools that can solve your problem, assuming a mixed partition of FAT and NTFS:

Tools that need to load the NTFS driver:
func

Tools that don't need to load the NTFS driver:
dspt
omnifs
ghost
gdisk

The above may need to be combined with other string extraction tools like find and strings to have practical meaning (put into batch processing). Only the idea is provided, and you need to find the method yourself.
Floor7 joyn Posted 2008-05-08 00:45
中级用户 Posts 105 Credits 280 From 广西
It can be done under CMD but not yet implemented in batch processing. First, enter diskpart by typing diskpart and pressing Enter under CMD. Then type list volume and press Enter to see all the disks on your machine. This hasn't been studied in batch processing yet.

[ Last edited by joyn on 2008-5-8 at 12:47 AM ]
Floor8 tsingfu Posted 2010-09-21 22:29
新手上路 Posts 1 Credits 0
fsutil fsinfo drives
Floor9 tuxw Posted 2010-09-23 17:47
新手上路 Posts 2 Credits 4
Pure DOS

drv.exe | find /C ":"
This returns the total number of drive letters

drv.exe | find /C "A:"
drv.exe | find /C "B:"
Floppy drives can be filtered out via batch processing

Then use findcd.exe to filter out CD-ROM drive letters, and you'll get the number of hard drive letters

[ Last edited by tuxw on 2010-9-22 at 21:52 ]
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023