keyboard

How to disable inbuilt keyboard on windows 11 laptop


My laptops keyboard is auto pressing win button and prinScn button continuously.

I have tried the to uninstall the driver from device manager, But it is not working for me. Then I have tried a powershell script which I have generated with chatgpt but it also failed to disable the built in keyboard.


Solution

  • If python installed in your system , use following script. In my case "/" was autopressing. But for coding purpose "/" was important for me as well. So I used "Num Lock" key as a toggle button for enabling/disabling "/". Please replace "/" with your keys in following code.

    import keyboard
    
    suppress_hook = None
    
    def on_key_event(event):
        if event.name == "/" and event.event_type == "down":
            return False
        return True
    
    def toggle_suppress():
        global suppress_hook
        if suppress_hook is None:
            suppress_hook = keyboard.hook(on_key_event, suppress=True)
            print("Key suppression enabled")
        else:
            keyboard.unhook(suppress_hook)
            suppress_hook = None
            print("Key suppression disabled")
    
    keyboard.add_hotkey('num lock', toggle_suppress)
    
    
    keyboard. Wait()
    

    You have to keep this script running whole time .