楼主解决问题也不贴出来让大家交流评价一下?!我来贴些相关的:
检测U盘符
@echo off
for /f %%i in ('"wmic logicaldisk where DriveType="2" get DeviceID |find /v "DeviceID""') do set DeviceID=%%i
if %DeviceID%*==A:* set DeviceID=没有发现可移动磁盘
if %DeviceID%*==* set DeviceID=没有发现可移动磁盘
echo %DeviceID%
pause>nul
检测U盘剩余空间
@echo off
for /f "tokens=1,2 delims==" %%i in ('wmic logicaldisk where Description^="可移动磁盘" get FreeSpace /value 2^>nul^|find "="') do set %%i=%%j
if %FreeSpace%*==* set FreeSpace=没有发现可移动磁盘
echo %FreeSpace%
pause>nul