@echo off
set AllDrive=c d e f g h i j k l m n o p q r s t u v w x y z
cd.>%tmp%\MyDrive.txt
for %%a in (%AllDrive%) do (
fsutil fsinfo drivetype %%a: | find /i "Removable Drive">>%tmp%\MyDrive.txt
)
for /f "tokens=1,2,3,4 delims= " %%h in (%tmp%\MyDrive.txt) do (
echo 可移动磁盘的盘符:%%h
)
del %tmp%\MyDrive.txt
@echo off
for /f "tokens=2 delims==" %%a in ('wmic LogicalDisk where "DriveType='2'" get * /value ^| findstr /i "^DeviceID"') do echo 可移动磁盘的盘符:%%a