1

I'm trying to keep all mice/keyboard/USB devices from waking a Windows 8.1 desktop without having to go back to device manager every time a device is plugged back in.

  • UEFI dual bios (Gigabyte GA-B75M-D3H): I can't find an option to disable wake-on-usb.

  • Device manager: I can't find an option to disable waking by default. Disabling an individual device only works until it is unplugged/plugged back in.

So I'd like to write a .bat to run at startup using powercfg -devicedisablewake. Unfortunately -devicedisablewake needs an exact device name as input. I.e.,

powercfg -devicedisablewake "HID-compliant mouse (006)" 

works, but anything else returns "Invalid Parameters -- try "/?" for help". "all", "*" aren't accepted as input.

powercfg -devicequery wake_armed > msg.txt

powercfg -devicedisablewake < msg.txt

fails, as does

powercfg -devicequery wake_armed|powercfg -devicedisablewake

Any suggestions?

Grant Palin
  • 1,112

1 Answers1

1

Try this in a batch file (you'll have to run it elevated to get it to work):

For /F "tokens=*" %%A in ('powercfg -devicequery wake_armed') do powercfg -devicedisablewake "%%A"

More info on batch "For"