China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-15 10:36
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » How to use DOS commands to view all drive letters of this computer? Count the number of drive letters? View 5,592 Replies 8
Original Poster Posted 2008-05-06 12:15 ·  中国 北京 光环新网
初级用户
Credits 50
Posts 19
Joined 2008-03-31 15:10
18-year member
UID 114544
Gender Male
Status Offline
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!
Floor 2 Posted 2008-05-06 14:09 ·  中国 广西 南宁 电信
中级用户
★★
丶杏灬丶
Credits 280
Posts 105
Joined 2008-05-06 03:37
18-year member
UID 117858
Gender Male
From 广西
Status Offline
@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
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
cao7113 +1 2008-05-07 17:11
Floor 3 Posted 2008-05-07 11:35 ·  中国 北京 光环新网
初级用户
Credits 50
Posts 19
Joined 2008-03-31 15:10
18-year member
UID 114544
Gender Male
Status Offline
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!
Floor 4 Posted 2008-05-07 13:09 ·  中国 广西 南宁 电信
中级用户
★★
丶杏灬丶
Credits 280
Posts 105
Joined 2008-05-06 03:37
18-year member
UID 117858
Gender Male
From 广西
Status Offline
If you think of sharing, come on~~ I haven't found the relevant command yet
Floor 5 Posted 2008-05-07 22:03 ·  中国 四川 遂宁 电信
初级用户
★★
Credits 121
Posts 54
Joined 2008-01-10 19:13
18-year member
UID 108238
Gender Male
Status Offline
Pure DOS commands, that is, commands running in DOS 7.1? This is a bit difficult...
Floor 6 Posted 2008-05-07 22:51 ·  中国 山东 青岛 阿里云
版主
★★★
操作系统爱好者
Credits 1,113
Posts 392
Joined 2002-11-11 00:00
23-year member
UID 228
Gender Male
Status Offline
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.
DOS之家 http://doshome.com 站长 葛明阳
Floor 7 Posted 2008-05-08 00:45 ·  中国 广西 南宁 电信
中级用户
★★
丶杏灬丶
Credits 280
Posts 105
Joined 2008-05-06 03:37
18-year member
UID 117858
Gender Male
From 广西
Status Offline
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 ]
Floor 8 Posted 2010-09-21 22:29 ·  中国 福建 福州 电信
新手上路
Credits 0
Posts 1
Joined 2010-02-21 20:08
16-year member
UID 160950
Gender Male
Status Offline
fsutil fsinfo drives
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
DOSroot -2 2010-09-23 10:25
Floor 9 Posted 2010-09-23 17:47 ·  中国 浙江 嘉兴 海宁市 电信
新手上路
Credits 4
Posts 2
Joined 2010-09-04 10:08
15-year member
UID 173571
Gender Male
Status Offline
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 ]
Forum Jump: