@echo off
for /f "tokens=2 delims==" %%a in ('wmic LogicalDisk where "DriveType='2'" get DeviceID /value') do (
set DriveU=%%a
)
echo.%DriveU%
pause
@echo off
for %%a in (c d e f g h i j k l m n o p q r s t u v w x y z) do (
for /f %%h in ('fsutil fsinfo drivetype %%a:^|findstr "Removable.* 可移动"') do (
set DriveU=%%h
)
)
echo.%DriveU%
pause
@echo off
echo,
echo 批处理确定U盘盘符
echo,
echo,
for /f "tokens=2 delims==" %%a in ('wmic LogicalDisk where "DriveType='2'" get DeviceID /value') do (
echo,
set DriveU=%%a
echo 已确定U盘盘符:%%a
)
echo,
echo,
pause
echo,
echo,
@echo off
for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
for /f %%h in ('fsutil fsinfo drivetype %%a:^|findstr "Removable.* 可移动"') do (
echo,
set DriveU=%%h
echo 已确定U盘盘符:%%h
)
)
echo,
echo,
echo,
pause
goto :EOF