Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 17, 2017, 11:27 AM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: [solved] HELP: disable/enable USB mouse service from command line  (Read 10042 times)


  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 866
    • View Profile
    • Donate to Member
I have a problem with my labtec 800 wireless mouse.
Sometimes when the computer starts the mouse is unresponsive and the LED light on its USB unit is off. I have found two different manual fixes:
1. physically disconnect + reconnect the USB unit, re-pair mouse and unit
2. open device manager, find the USB HID with an error, right click: disable + enable


I want to automate fix number 2. Things I've tried that did not work:

devcon.exe commands:
devcon restart [HID]
devcon disable [HID]
devcon enable [HID]

restarting the HidServ service:
net stop HidServ
net start HidServ

Any suggestions?
« Last Edit: January 25, 2009, 05:35 AM by Nod5 »


  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 252
  • Move over and give us some room...
    • View Profile
    • Elite Freeware
    • Donate to Member
Re: HELP: disable/enable USB mouse service from command line
« Reply #1 on: January 24, 2009, 04:53 PM »
Usbdeview can enable/disable USB devices and it has command line support. It's worth a look.
Mouser is made of win and awesome!


  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 866
    • View Profile
    • Donate to Member
Re: HELP: disable/enable USB mouse service from command line
« Reply #2 on: January 25, 2009, 03:56 AM »
No that didn't work either. When the error occurs the device is listed as unconnected even when it is physically connected (the multiple copies of the same device in the list comes from it having been plugged into different USB hub ports)

tried devcon again just now and solved it by making a .bat file that disables+enables the whole class of devices:
devcon disable =HIDClass
devcon enable =HIDClass
When the error occurs I just use FARR to run the .bat file

The above worked for the mouse but also had the drawback of messing with the multimedia keys of my keyboard (until the next restart). That is caused by the .bat file disabling/enabling too many devices. So I made a new attempt at disabling/enabling only the specific mouse device. It now works when I specify it like this:
devcon disable *PID_XYZ*
devcon enable *PID_XYZ*
where XYZ is replaced with data for the specific device (as shown in the properties > information tab for the device in Device Manager). It remains to see if that value can change, but it works so far.
Edit3: Yes, it definitely works. I think the problem with my first attempt was to specify the complete string ID string from the device properties (including the backslashes). The shorter command with wildcards above did the trick.

Ideally I'd like to automate this even more so that a script runs on each boot and checks the mouse device status. When the mouse was not responding then the device properties had a special flag (I think it had problem or error in the name but don't remember exactly). But I can't find a way to check for that flag through devcon. So for the moment I'll just run the above script on each reboot.
« Last Edit: January 29, 2009, 11:22 AM by Nod5 »