| 
 
cao7113 
初级用户
 
  
 
  
  
积分 50 
发帖 19 
注册 2008-3-31 
状态 离线
 | 
『楼 主』:
 如何用dos命令查看本计算机所有盘符?统计盘符个数?
 
使用 LLM 解释/回答一下
  
rt,如何使用dos名令查看当前运行dos命令的计算机有几个硬盘符,向高手请教答案。联系: sdcrj@sina.com,谢谢!  
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!  
    
 
  
 |   
 | 
  2008-5-6 12:15 | 
  
 | 
 | 
 
joyn 
中级用户
 
    丶杏灬丶
  
 
积分 280 
发帖 105 
注册 2008-5-6 来自 广西 
状态 离线
 | 
『第 2 楼』:
 我想不到DOS的命令~~但是我想用到WMI比较简单点^_^
 
使用 LLM 解释/回答一下
  
@echo off 
title 查询盘符 
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 任意键退出..... 
pause >nul 
exit 
@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 
    
 
 
 
  
 |   
 | 
  2008-5-6 14:09 | 
  
 | 
 | 
 
cao7113 
初级用户
 
  
 
  
  
积分 50 
发帖 19 
注册 2008-3-31 
状态 离线
 | 
『第 3 楼』:
 多谢分享!不过用纯dos能实现吗?
 
使用 LLM 解释/回答一下
  
哈哈,使用其它手段肯定能实现,多谢您的分享! 
不过个人还是想能获得纯dos的解决方案。dos被称为磁盘操作系统,理论上应该能实现该功能,可能dos内部的资料较少,所以在我们看来这个功能不好实现。 
 
可能本问题确实不好解决,不过还好,让我们平时学习时可以更深入的思考! 
谢谢! 
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! 
    
 
  
 |   
 | 
  2008-5-7 11:35 | 
  
 | 
 | 
 
joyn 
中级用户
 
    丶杏灬丶
  
 
积分 280 
发帖 105 
注册 2008-5-6 来自 广西 
状态 离线
 | 
『第 4 楼』:
 
 
使用 LLM 解释/回答一下
  
如果想到了分享哈~~我还没找到相关的命令 
If you think of sharing, come on~~ I haven't found the relevant command yet 
    
 
  
 |   
 | 
  2008-5-7 13:09 | 
  
 | 
 | 
 
clong 
初级用户
 
  
 
  
  
积分 121 
发帖 54 
注册 2008-1-10 
状态 离线
 | 
『第 5 楼』:
 
 
使用 LLM 解释/回答一下
  
纯DOS命令,也就是在DOS7.1运行的命令?这个有点难办…… 
Pure DOS commands, that is, commands running in DOS 7.1? This is a bit difficult... 
    
 
  
 |   
 | 
  2008-5-7 22:03 | 
  
 | 
 | 
 
gmy 
版主
 
         操作系统爱好者
  
 
积分 1113 
发帖 392 
注册 2002-11-11 
状态 离线
 | 
『第 6 楼』:
 
 
使用 LLM 解释/回答一下
  
纯DOS下,我有5个工具,可以解决你的问题,假设FAT和NTFS混合分区: 
 
需要加NTFS驱动的: 
func 
 
不需要加载NTFS驱动的: 
dspt 
omnifs 
ghost 
gdisk 
 
以上可能需要配合其它字符串提取工具find和strings等才能有实际意义(放到批处理里),只提供思路,方法自己去找。 
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 站长 葛明阳 |   
 | 
  2008-5-7 22:51 | 
  
 | 
 | 
 
joyn 
中级用户
 
    丶杏灬丶
  
 
积分 280 
发帖 105 
注册 2008-5-6 来自 广西 
状态 离线
 | 
『第 7 楼』:
 
 
使用 LLM 解释/回答一下
  
CMD下可以办到就是在批处理里面还没有实现  
首先在CMD下输入 diskpart 回车进入diskpart模式 
在输入list volume 回车就可以看到你机器上的所有磁盘了 
这个在批处理里面还没有研究过~~ 
 
 Last edited by joyn on 2008-5-8 at 12:47 AM ] 
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 ] 
    
 
  
 |   
 | 
  2008-5-8 00:45 | 
  
 | 
 | 
 
tsingfu 
新手上路
 
 
 
  
  
积分 0 
发帖 1 
注册 2010-2-21 
状态 离线
 | 
 | 
  2010-9-21 22:29 | 
  
 | 
 | 
 
tuxw 
新手上路
 
 
 
  
  
积分 4 
发帖 2 
注册 2010-9-4 
状态 离线
 | 
『第 9 楼』:
 
 
使用 LLM 解释/回答一下
  
纯DOS 
 
drv.exe | find /C ":" 
这个返回的是所有盘符数 
 
drv.exe | find /C "A:" 
drv.exe | find /C "B:" 
软驱,可通过批处理过滤掉 
 
再用findcd.exe过滤掉光盘盘符,就得到硬盘符数量了 
 
 Last edited by tuxw on 2010-9-22 at 21:52 ] 
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 ] 
    
 
  
 |   
 | 
  2010-9-23 17:47 | 
  
 |