VB Script: How to simulate keyboard keys

Do you need to refresh your computer at startup? Do you need to create a complex command that simulate one or more keys from your keyboard? Have you ever wonder how to make a script to simulate your keyboard?

All you need is to create a VB Script with following command:

1. Create a file called “kkey.vbs”

2. Edit your file using notepad or any text editor you prefer.

3. Add the following code to you script:

Set objShell = CreateObject("WScript.Shell")
objShell.SendKeys "{k}"

4. This script will simulate pressing the k key fom your keyboard. You you whant a different letter or button check out the definition of .SendKeys Class from MSDN.

Have fun!

Leave a Reply