23/07/23 21:05:51.47 JLqJNtpp.net
set id="~"
SETLOCAL ENABLEDELAYEDEXPANSION
FOR /F "delims=" %%i IN ('devcon status !id!') DO (
set a=%%i
if "!a!" NEQ "!a:Driver is running=!" devcon disable !id! & goto :eof
if "!a!" NEQ "!a:Device is disabled=!" devcon enable !id! & goto :eof
)
管理者権限で実行
複数の matching の場合はどうなるか知らない