Google will find many examples for whatever Linux distro you pick. For Windows I use DevCon, but you could get by with a ghetto AutoHotKey script along these lines:
Disable Device (WinKey + X example)
#x::
Run, devmgmt.msc ; Open Device Manager
Sleep 1000 ; Wait for Device Manager to load, adjust as preferred
WinActivate, Device Manager ; Set focus to Device Manager
Sleep 100
ControlClick, SysTreeView321, Device Manager,,,, NA ; Simulate click on Device Manager (without this, no keyboard input is accepted)
Sleep 100
Send {Tab} ; Move focus to the device ListView control
Sleep 100
Send {Down}{Down}{Down}{Right}{Down}{AppsKey}d ; Random example; adjust the number of {Down} commands to get to the dev family
; you want, the right arrow to expand devices, and down again to set focus on a
; particular device. Then hit the menu key to open the context menu and the D
; key to disable the selected device.
Sleep 100
WinClose, Device Manager ; Close Device Manager
ReturnNote that when a device is disabled, its device family is automatically expanded in the device manager. So, enabling a device is a little different in the 10th line:
Enable Device (WinKey + Z example)
#z::
Run, devmgmt.msc ; Open Device Manager
Sleep 1000 ; Wait for Device Manager to load, adjust as preferred
WinActivate, Device Manager ; Set focus to Device Manager
Sleep 100
ControlClick, SysTreeView321, Device Manager,,,, NA ; Simulate click on Device Manager (without this, no keyboard input is accepted)
Sleep 100
Send {Tab} ; Move focus to the device ListView control
Sleep 100
Send {Down}{Down}{Down}{Down}{AppsKey}e ; No right-arrow as the dev family is already expanded; E for Enable instead of D
Sleep 100
WinClose, Device Manager ; Close Device Manager
ReturnNOTE: If you're using non-English Windows, your shortcut keys for _E_nable and _D_isable may differ -- change as appropriate.
DevCon is much cleaner and easier though. I've attached the x86 and x64 versions (incl. checksums;
x86 scan here /
x64 scan here) to this post; follow these steps:
- Extract the desired DevCon version to e.g. C:\Windows\System32
- Go into Device Manager, select your keyboard device (usu. HID Keyboard Device), right-click and go into Properties
- Move to the Details tab, and select Hardware Ids from the combobox
- Right-click the first value in the Value textbox and copy it to the clipboard
- Paste this hardware ID somewhere for safekeeping, and repeat these steps for any additional keyboard devices (this laptop has two, though only one seems to affect keyboard input)
This is the DevCon syntax to remove a device (include the double-quotes):
devcon.exe remove "HARDWARE_ID_HERE"Repeat for other keyboard devices if needed; the internal keyboard will now be disabled immediately and completely. To restore the keyboard, use this command:
devcon.exe rescanYou can trigger these commands from a hidden command window in AHK, e.g. WinKey + 0 example:
#0::Run, C:\Windows\System32\devcon.exe remove "HID\VID_0B05&PID_17E0&REV_0249&MI_00", , HideHTH.