3

So most information I've found online for disabling your laptop keyboard in Windows 10 is to go into Device Manager and uninstall the driver for your built-in keyboard so it will only use the input from your external one.

What I'd like to know is:

  • Is there any other way to do this? This seems like a hack/workaround.

  • Most information I've come across says that to re-enable your built-in keyboard, you just restart your machine. Is there a faster way to toggle the enabled/disabled state?

  • Can I automate/script this process? It would be really cool if I could write a program that toggles the state of the built-in keyboard either with a button press or click, or if it detects a certain USB device being plugged in.

EDIT

So this is what devcon says about my keyboard hardware:

HID\VID_320F&PID_500D&MI_00\7&FD25638&0&0000
    Name: HID Keyboard Device
    Hardware IDs:
        HID\VID_320F&PID_500D&REV_0100&MI_00
        HID\VID_320F&PID_500D&MI_00
        HID\VID_320F&UP:0001_U:0006
        HID_DEVICE_SYSTEM_KEYBOARD
        HID_DEVICE_UP:0001_U:0006
        HID_DEVICE

HID\VID_320F&PID_500D&MI_01&COL01\7&33A993FA&0&0000 Name: HID Keyboard Device Hardware IDs: HID\VID_320F&PID_500D&REV_0100&MI_01&Col01 HID\VID_320F&PID_500D&MI_01&Col01 HID\VID_320F&UP:0001_U:0006 HID_DEVICE_SYSTEM_KEYBOARD HID_DEVICE_UP:0001_U:0006 HID_DEVICE

ACPI\MSNB1001\4&2B980D14&0 Name: Standard PS/2 Keyboard Hardware IDs: ACPI\VEN_MSNB&DEV_1001 ACPI\MSNB1001 MSNB1001 Compatible IDs: PNP0303

HID\VID_046D&PID_C52B&MI_00\7&DB720BD&0&0000 Name: HID Keyboard Device Hardware IDs: HID\VID_046D&PID_C52B&REV_2411&MI_00 HID\VID_046D&PID_C52B&MI_00 HID\VID_046D&UP:0001_U:0006 HID_DEVICE_SYSTEM_KEYBOARD HID_DEVICE_UP:0001_U:0006 HID_DEVICE

If I do this:

C:\Windows\system32>devcon.exe disable HID_DEVICE_SYSTEM_KEYBOARD

I get:

HID\VID_320F&PID_500D&MI_00\7&FD25638&0&0000                : Disable failed
HID\VID_320F&PID_500D&MI_01&COL01\7&33A993FA&0&0000         : Disable failed
HID\VID_046D&PID_C52B&MI_00\7&DB720BD&0&0000                : Disable failed
No matching devices found.

I don't know why my built-in keyboard shows up 3 times either. The 4th keyboard is the USB one I don't want to disable.

I'm definitely running CMD as admin, and the devcon status and restart commands work properly.

1 Answers1

3

The easiest way is to disable a device, e.g. "Standard PS/2 keyboard*, not to completely remove its drivers. And the simplest way to script this is with Microsoft's small command-line utility, devcon.exe.

  • First, download devcon from Microsoft. For Windows 10, v. 1803 and later,

    • Download the CAB file (just ~6 MB),
    • Open the CAB file in Windows Explorer or 7-Zip,
    • Extract the file filbad6e2cce5ebc45a401e19c613d0a28f and
    • Rename that file to devcon.exe.
    • Put devcon.exe in a location in PATH, e.g., %SystemRoot%\system32, or use the full path to devcon.exe in batch files.
    • [For safety, you can check it in VirusTotal.]
  • Find the ID of the keyboard device:

    • Press Windows, type CMD, and press CtrlShiftEnter to open a CMD prompt as Administrator.

    • Use cd to move to the folder holding devcon.exe.

    • Enter the following to find the hardware ID's of all devices.

      devcon.exe hwids *

    • Copy all the CMD text withCtrlA.

    • Paste the text into any text editor, such as Notepad, and search for keyb.

    • There are multiple ID's for that device; pick one that is unique in that list, which is shown as <device-name>, below.

  • Now you can create two very short scripts to disable and to enable the keyboard.

    • Create a text file; insert into it devcon.exe disable "<device-name>", including quotation marks.
    • Save the file and rename the text file to disable-keyboard.bat.
    • Create a text file; insert into it devcon.exe enable "<device-name>", including quotation marks.
    • Save the file and rename the text file to enable-keyboard.bat.

Now, just run one script (as Administrator) to disable he keyboard, and the the other to re-enable it. To make that easier yet, create shortcuts to the two scripts and set in Advanced properties to Run as Administrator.

Believe it or not, despite the long description, you can do this in just a few minutes.

N.B. Once you've disabled the keyboard, you'll need some way to run the re-enabling script *without use of the keboard.