0

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.

peaceoutside
  • 113
  • 6

2 Answers2

1

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.

DrMoishe Pippik
  • 25,661
  • 4
  • 36
  • 54
  • Wow thanks! This is incredibly helpful. Is devcon.exe the only way to disable devices like this? It seems weird to me that device manager doesn't allow you to right click & enable/disable a keyboard device in the GUI. – peaceoutside Mar 04 '21 at 17:21
  • I'm having an issue with the last step though. I'll post as an edit to the main question since this doesn't have enough space. – peaceoutside Mar 04 '21 at 17:42
  • @peaceoutside, you need quotes around device name, e.g. "HID_DEVICE_SYSTEM_KEYBOARD". As for other keyboards, perhaps different external keyboards had been plugged in at one time? – DrMoishe Pippik Mar 04 '21 at 23:07
  • I think my version of devcon.exe isn't compatible with my current version and type of Windows. It's really annoying that there isn't a direct download for this file that is provided my Microsoft that verifies the proper version. I'm just going to try to get it via installing the Windows SDK instead. – peaceoutside Mar 08 '21 at 17:35
0

Why would you lead us through such steps for creating only C:\Windows\System32\myfolder\devcon.exe enable "HID_DEVICE_SYSTEM_KEYBOARD" and, separately, C:\Windows\System32\myfolder\devcon.exe disable "HID_DEVICE_SYSTEM_KEYBOARD" in the end?

Unfortunately, the execution of enable-keyboard.bat or disable-keyboard.bat have no effect whatsoever on whether the touch keyboard pops up or not.

I want to use the touch keyboard only when my language is set on en-US. When the language is set on other than en-US, I don't want the touch keyboard to pop up - because I use another, more optimal keyboard. Enabling or disabling the pop-up could as well be directly linked to changing the language, or, alternatively, changing the language could directly be linked to enabling/disabling the pop-up capability of the touch keyboard.

Ideally, the touch keyboard would always remain in en-US. Sometimes I still don't want it to pop up, that would still need a quick solution. That is THE BIG DEAL here, because changing the language alone happens so fast and comfortably with ctrl+shift. Ideally, the hardware keyboard would always remain in my other language.