这是脚本:
$devid = "*HID\VID_0EEF&PID_A001&REV_1213&Col01"
$status = devcon status $devid | Select-String "running"
if($status -eq $null) {
write-host "Enabling touch"
devcon enable $devid
} else {
write-host "Disabling touch"
devcon disable $devid
devcon restart $devid
}
这就是我所拥有的:
@ECHO OFF
SET devid="HID\VID_0EEF&PID_A001&REV_1213&Col01"
set status=
for /f "tokens=10" %%i in ('devcon status %devid%') do @set status=%%i
IF %status%==running (
devcon enable %devid%
) ELSE (
devcon disable %devid%
devcon restart %devid%
)
但这不起作用,我无法弄清楚问题所在。