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
  • 4
  • 13
  • 31
user282641
  • 11
  • 2
  • You've asked two questions here. One of those questions is a essentially a duplicate of http://superuser.com/questions/631637/how-to-disallow-usb-devices-to-wake-the-computer-by-default-in-windows-7/ The other question is regarding .bat file syntax, which has been answered below. Your attempted approach to enumerating active devices will NOT change the default for all devices, including after they have been plugged into a new USB port. (See http://superuser.com/a/1006622/226996) – Allen Pestaluky Nov 28 '15 at 20:05

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"

Ƭᴇcʜιᴇ007
  • 111,883
  • 19
  • 201
  • 268