0

I started learning AutoHotKey and wanted to know if it was possible to write a script that allows me to enable/disable a device in device manager without having to manually unplug/plug the device from the computer. I wasn't sure if I needed to run the script on the command line and somehow access the API of the Device Manager through there and write one/two lines of code that allows to enable/disable. I did stumble across the API: DeviceIoControl. I think I can get the handle of the device by using the CreateFile function that has the name of the device. The problem is I'm not sure how to properly use the name of the device in order to enable/disable it.

newbie_at_linux
  • 35
  • 1
  • 2
  • 8
  • `DeviceIoControl` is for communication with a device, not the device manager. – IInspectable Feb 14 '20 at 19:12
  • @IInspectable If its with the communication with the device then in theory would it be possible to enable/disable it? I assume DeviceIoControl cuts/restore communication from the device to the computer? – newbie_at_linux Feb 14 '20 at 19:26
  • [This](https://stackoverflow.com/a/1610140/3813732) should probably do the trick? If you'll have trouble converting it over to AHK, I might be able to help. – 0x464e Feb 15 '20 at 00:07

0 Answers0