點擊「安全移除硬體」弹出 USB 隨身碟後,若又想繼續使用,通常得拔插實體介面。利用 Microsoft 官方命令列工具 DevCon (Device Manager Command Line) 撰寫批次檔,即可在不拔插的情況下重新啟用裝置。
在 `devcon.exe` 同目錄新建 `RemountUSB.bat`:
@echo off
rem 替換為你的裝置範例 ID,保留 @ 和雙引號
set DEV_ID=@"USB\ROOT_HUB20\4&1A2797B1&0"
echo 正在停用 USB 裝置...
devcon disable %DEV_ID%
echo 正在啟用 USB 裝置...
devcon enable %DEV_ID%
echo 完成!請檢查「這台電腦」是否出現磁碟機代號。
pause
@echo off
for /f "tokens=*" %%a in ('devcon find USB\VID_*^&PID_*') do (
set DEV_ID=%%a
goto :DO_REMOUNT
)
:DO_REMOUNT
if defined DEV_ID (
devcon disable @%DEV_ID%
devcon enable @%DEV_ID%
) else (
echo 找不到 USB 大容量儲存裝置
)
pause
Windows XP / Server 2003 / Vista / 7 / 8 / 8.1 / 10 / 11 / Server 2008-2022 (需對應架構 devcon.exe)。