Answers:
使用以下内容:
wmic logicaldisk where drivetype=2 get deviceid, volumename, description | findstr /C:"Removable Disk"
if %errorlevel% == 0 (
Rem Put commands in here to run if disk is found
) else (
Rem Put commands in here to run if disk not found
)
最简单的方法是将批处理文件设置为每隔x分钟在计划任务上运行 - 尽管在“检测到”可移动磁盘之前可能需要多达几分钟。