网上瞎逛俄而看到的,WinXP下利用Diskpart按类型枚举盘符目前为止是最简便的-
- @echo off
- :::::枚举本地磁盘盘符
- for /f "tokens=3" %%i in ('echo list volume^|diskpart^|findstr "分区"') do echo %%i:
- pause
复制代码
-
- @echo off
- :::::枚举光盘盘符
- for /f "tokens=3" %%i in ('echo list volume^|diskpart^|findstr "CD-ROM"') do echo %%i:
- pause
复制代码
-
- @echo off
- :::::枚举FAT32盘符
- for /f "tokens=3" %%i in ('echo list volume^|diskpart^|findstr "分区 FAT32"') do echo %%i:
- pause
复制代码
-
- @echo off
- :::::枚举NTFS盘符
- for /f "tokens=3" %%i in ('echo list volume^|diskpart^|findstr "分区 NTFS"') do echo %%i:
- pause
复制代码
-
- @echo off
- :::::枚举U盘盘符
- for /f "tokens=3" %%i in ('echo list volume^|diskpart^|findstr "可移动"') do echo %%i:
- pause
复制代码
|