What's new   Download   Home  Ads

This utility is a tiny Microsoft® Windows® application of only one file, the SendKeys.exe, that can be executed with arguments in the command line to send keystrokes to other application window running on the Windows in an independent way (simulating multithreading in the calling code) with options to control the start, the throughout and the end of the sending.

It’s interesting to be called from codes of any only one thread language like the Microsoft Visual Basic® for Application (VBA) in Microsof Office where built-in Sendkeys statement can’t offer an adequate control to be called from determined positions of a procedure. It’s also interesting to be called from the dialog box of Windows Run command, from Windows Shortcuts, and from scripts that haven’t SendKeys statement like command lines in Windows console (CMD batch file, DOS BAT).

Following items in this page:



Complete Syntax of the String to Send

Extra VBA Additional Key Codes


- Can be defined a wait in seconds before to start the keystroke sending

- Can be defined a wait in seconds to give up, if the target windows aren't found

- The target window can be the active windows or one with defined title

- The syntax of the string to be sent is the same of the VBA Sendkeys statement with some additional key codes not existent in VBA for:

1 - Print Screen keys

2 - Pauses between sent keys

3 - Keypad keys

4 - Logoff, restart or shutdown the system

5 - Send API virtual keys by their decimal codes

- Runs in silence and, optionally, until without fail alert

- Can register the execution end saving a log file (Sendkeys.log) in the disk that can be used for synchronization

- Can be realized simultaneous instances and keys can be sent to more of one window simultaneously

- Running SendKeys.exe without arguments, it shows a dialog with a quick help, a command to test and other command for more detail help


Path\SendKeys.exe Arg1 Arg2 Arg3 Arg4 [Arg5]
Arguments are separated by spaces and Arg5 is optional.

Arg1 - Wait in seconds or fractions before starting to send keys (This waiting count only starts when the target window is found and activated)

Arg2 - Wait in seconds to give up, if the target window isn't found

Arg3 - String of target window title (See Note1 and 2)

Arg4 - String with keys to be sent (See Note1 and 3 )

Arg5 - Optional: 1 - Run in silence without fail alert; 2 - Save a log file (Sendkeys.log) on the disk to mark the execution end and which can be used to synchronize thus: the calling code first deletes this log file, sends the keys, and pauses in a check loop until it is created again to then continue.

Note1: Quotation marks are necessary, if there is space in the string.

Note2: In place of the window title you can use too the number returned by Shell function. Empty title (Quotation marks without text) sends keys to the active window.

Note3: To send special keys, see VBA help for the Sendkeys statement.  See Complete Syntax of the String to Send.


1 - In VBA, you use the Shell function as in the below test code:

Sub Test()
    Dim Ret
    Shell "Notepad.exe", vbNormalFocus
    Ret = Shell("Path\SendKeys.exe 1 10 ""Untitled - Notepad"" ""Hello!~{PAUSE}After of 1s.~{PAUSE 2}After of 3s.~""", vbNormalFocus)
End Sub

2 - In the Windows console, in Windows shortcuts, in DOS BAT, or in the dialog box of Windows Run command, it can be something like:

SendKeys.exe 1 10 "Untitled - Notepad" "Hello!~{PAUSE}After of 1s.~{PAUSE 2}After of 3s.~"

Complete Syntax of the String to Send:

Each key is represented by one or more characters. To specify a single keyboard character, use the character itself. For example, to represent the letter A, use "A" for string. To represent more than one character, append each additional character to the one preceding it. To represent the letters A, B, and C, use "ABC" for string.

The plus sign (+), caret (^), percent sign (%), tilde (~), and parentheses ( ) have special meanings to SendKeys. To specify one of these characters, enclose it within braces ({}). For example, to specify the plus sign, use {+}. Brackets ([ ]) have no special meaning to SendKeys, but you must enclose them in braces. In other applications, brackets do have a special meaning that may be significant when dynamic data exchange (DDE) occurs. To specify brace characters, use {{} and {}}.

To specify characters that aren't displayed when you press a key, such as ENTER or TAB, and keys that represent actions rather than characters, use the codes shown below:

Key Code
F1 {F1}
F2 {F2}
F3 {F3}
F4 {F4}
F5 {F5}
F6 {F6}
F7 {F7}
F8 {F8}
F9 {F9}
F10 {F10}
F11 {F11}
F12 {F12}
F13 {F13}
F14 {F14}
F15 {F15}
F16 {F16}

To specify keys combined with any combination of the SHIFT, CTRL, and ALT keys, precede the key code with one or more of the following codes:

Key Code

To specify that any combination of SHIFT, CTRL, and ALT should be held down while several other keys are pressed, enclose the code for those keys in parentheses. For example, to specify to hold down SHIFT while E and C are pressed, use "
+(EC)". To specify to hold down SHIFT while E is pressed, followed by C without SHIFT, use "+EC".

To specify repeating keys, use the form {key number}. You must put a space between key and number. For example, {LEFT 42} means press the LEFT ARROW key 42 times; {h 10} means press H 10 times.

1 - You can't use SendKeys to send keystrokes to an application that is not designed to run in Microsoft Windows.
2 - These standard VBA codes do not distinguish the SHIFT, CTRL and ALT control keys on the right side of the keyboard from the respective keys on the left side. However there are settings that these keys have custom functionality when, for example, using virtual machines, but Extra VBA Additional Key Codes described below allow to distinguish, see example 2 for the codes {VK nn} and {VK_nn}


Tested with Microsoft Office for Windows, versions 97 (See Note), 2000, 2002(XP), 2003, 2007, 2010 (32 and 64-bit), 2013 (32 and 64-bit), 2016 (32 and 64-bit), and 2019 (32 and 64-bit) in MSI-based and Click-To-Run installations of Office 365™ cloud-based services.


Download the English version here   
You also can download from this mirror site   
Last update: 03/21/2022 - 39.5kb    
Freeware based in this License Agreement   

Extra VBA Additional Key Codes:

These key codes, although they don’t exist in VBA, are also supported here:



Print Screen - Full Screen {PRTSC}
Print Screen - Active Window %{PRTSC}
Pause 1 second {PAUSE}
Pause n seconds {PAUSE n}


Keypad 0 {NUMPAD0}
Keypad 1 {NUMPAD1}
Keypad 2 {NUMPAD2}
Keypad 3 {NUMPAD3}
Keypad 4 {NUMPAD4}
Keypad 5 {NUMPAD5}
Keypad 6 {NUMPAD6}
Keypad 7 {NUMPAD7}
Keypad 8 {NUMPAD8}
Keypad 9 {NUMPAD9}
Keypad + {ADD}
Keypad - {SUBTRACT}
Keypad * {MULTIPLY}
Keypad / {DIVIDE}
Keypad decimal


Sends 'Ctrl + Alt + DEL' keys to POWER
OFF the computer, IF POSSIBLE
Sends 'Ctrl + Alt + DEL' keys to POWER
OFF the computer, FORCIBLY
Sends 'Ctrl + Alt + DEL' keys to RESTART
the computer, IF POSSIBLE
Sends 'Ctrl + Alt + DEL' keys to RESTART
the computer, FORCIBLY
Sends 'Ctrl + Alt + DEL' keys to LOGOFF
the user, IF POSSIBLE
Sends 'Ctrl + Alt + DEL' keys to LOGOFF
the user, FORCIBLY.

Sends the API virtual key of decimal code nn
in NORMAL WAY (downing and releasing)
{VK nn}
Sends the API virtual key of decimal code nn

With these codes {VK nn} and {VK_nn}, you can send any key or key combinations. Pressing a control button sending its {VK_nn} code, it will be pressed until its {VK nn} normal code is sent. For example:

1 - If you want to send the shortcut key composed by ‘Windows Button’ and the letter ‘R’, first send the ‘Windows Button’ key only downing, then the ‘R’ key, and finally the ‘Windows Button’ key normally to release it, like this: {VK_91}{VK 82}{VK 91}

2 - If you want to send the shortcut key composed of ALT on the left side of the keyboard and the letter ‘S’, first send that ALT key only downing, then the ‘S’ key, and finally the ALT key normally to release it, like this: {VK_164}{VK 83}{VK 164}

The table below was assembled from this vitual-key codes list in MSDN. It lists each of 254 possible decimal numbers for virtual keys with the corresponding physical keys already assigned by Microsoft.



Code Symbolic API Const Hex
1 Left mouse button {VK 1} VK_LBUTTON 0x01
2 Right mouse button {VK 2} VK_RBUTTON 0x02
3 Control-break processing {VK 3} VK_CANCEL 0x03
4 Middle mouse button (three-button mouse) {VK 4} VK_MBUTTON 0x04
5 Windows 2000/XP: X1 mouse button {VK 5} VK_XBUTTON1 0x05
6 Windows 2000/XP: X2 mouse button {VK 6} VK_XBUTTON2 0x06
7 Undefined {VK 7} 0x07
8 BACKSPACE key {VK 8} VK_BACK 0x08
9 TAB key {VK 9} VK_TAB 0x09
10 Reserved {VK 10} 0x0A
11 Reserved {VK 11} 0x0B
12 CLEAR key {VK 12} VK_CLEAR 0x0C
13 ENTER key {VK 13} VK_RETURN 0x0D
14 Undefined {VK 14} 0x0E
15 Undefined {VK 15} 0x0F
16 SHIFT key {VK 16} VK_SHIFT 0x10
17 CTRL key {VK 17} VK_CONTROL 0x11
18 ALT key {VK 18} VK_MENU 0x12
19 PAUSE key {VK 19} VK_PAUSE 0x13
20 CAPS LOCK key {VK 20} VK_CAPITAL 0x14
21 Input Method Editor (IME) Kana mode, Hanguel, or Hangul mode {VK 21} VK_KANA, VK_HANGUEL, VK_HANGUL 0x15
22 Undefined {VK 22} 0x16
23 IME Junja mode {VK 23} VK_JUNJA 0x17
24 IME final mode {VK 24} VK_FINAL 0x18
25 IME Hanja mode, IME Kanji mode {VK 25} VK_HANJA, VK_KANJI 0x19
26 Undefined {VK 26} 0x1A
27 ESC key {VK 27} VK_ESCAPE 0x1B
28 IME convert {VK 28} VK_CONVERT 0x1C
29 IME nonconvert {VK 29} VK_NONCONVERT 0x1D
30 IME accept {VK 30} VK_ACCEPT 0x1E
31 IME mode change request {VK 31} VK_MODECHANGE 0x1F
33 PAGE UP key {VK 33} VK_PRIOR 0x21
34 PAGE DOWN key {VK 34} VK_NEXT 0x22
35 END key {VK 35} VK_END 0x23
36 HOME key {VK 36} VK_HOME 0x24
37 LEFT ARROW key {VK 37} VK_LEFT 0x25
38 UP ARROW key {VK 38} VK_UP 0x26
39 RIGHT ARROW key {VK 39} VK_RIGHT 0x27
40 DOWN ARROW key {VK 40} VK_DOWN 0x28
41 SELECT key {VK 41} VK_SELECT 0x29
42 PRINT key {VK 42} VK_PRINT 0x2A
43 EXECUTE key {VK 43} VK_EXECUTE 0x2B
45 INS key {VK 45} VK_INSERT 0x2D
46 DEL key {VK 46} VK_DELETE 0x2E
47 HELP key {VK 47} VK_HELP 0x2F
48 0 key {VK 48} 0x30
49 1 key {VK 49} 0x31
50 2 key {VK 50} 0x32
51 3 key {VK 51} 0x33
52 4 key {VK 52} 0x34
53 5 key {VK 53} 0x35
54 6 key {VK 54} 0x36
55 7 key {VK 55} 0x37
56 8 key {VK 56} 0x38
57 9 key {VK 57} 0x39
58 Undefined {VK 58} 0x3A
59 Undefined {VK 59} 0x3B
60 Undefined {VK 60} 0x3C
61 Undefined {VK 61} 0x3D
62 Undefined {VK 62} 0x3E
63 Undefined {VK 63} 0x3F
64 Undefined {VK 64} 0x40
65 A key {VK 65} 0x41
66 B key {VK 66} 0x42
67 C key {VK 67} 0x43
68 D key {VK 68} 0x44
69 E key {VK 69} 0x45
70 F key {VK 70} 0x46
71 G key {VK 71} 0x47
72 H key {VK 72} 0x48
73 I key {VK 73} 0x49
74 J key {VK 74} 0x4A
75 K key {VK 75} 0x4B
76 L key {VK 76} 0x4C
77 M key {VK 77} 0x4D
78 N key {VK 78} 0x4E
79 O key {VK 79} 0x4F
80 P key {VK 80} 0x50
81 Q key {VK 81} 0x51
82 R key {VK 82} 0x52
83 S key {VK 83} 0x53
84 T key {VK 84} 0x54
85 U key {VK 85} 0x55
86 V key {VK 86} 0x56
87 W key {VK 87} 0x57
88 X key {VK 88} 0x58
89 Y key {VK 89} 0x59
90 Z key {VK 90} 0x5A
91 Left Windows key (Microsoft Natural keyboard) {VK 91} VK_LWIN 0x5B
92 Right Windows key (Natural keyboard) {VK 92} VK_RWIN 0x5C
93 Applications key (Natural keyboard) {VK 93} VK_APPS 0x5D
94 Reserved {VK 94} 0x5E
95 Computer Sleep key {VK 95} VK_SLEEP 0x5F
96 Numeric keypad 0 key {VK 96} VK_NUMPAD0 0x60
97 Numeric keypad 1 key {VK 97} VK_NUMPAD1 0x61
98 Numeric keypad 2 key {VK 98} VK_NUMPAD2 0x62
99 Numeric keypad 3 key {VK 99} VK_NUMPAD3 0x63
100 Numeric keypad 4 key {VK 100} VK_NUMPAD4 0x64
101 Numeric keypad 5 key {VK 101} VK_NUMPAD5 0x65
102 Numeric keypad 6 key {VK 102} VK_NUMPAD6 0x66
103 Numeric keypad 7 key {VK 103} VK_NUMPAD7 0x67
104 Numeric keypad 8 key {VK 104} VK_NUMPAD8 0x68
105 Numeric keypad 9 key {VK 105} VK_NUMPAD9 0x69
106 Multiply key {VK 106} VK_MULTIPLY 0x6A
107 Add key {VK 107} VK_ADD 0x6B
108 Separator key {VK 108} VK_SEPARATOR 0x6C
109 Subtract key {VK 109} VK_SUBTRACT 0x6D
110 Decimal key {VK 110} VK_DECIMAL 0x6E
111 Divide key {VK 111} VK_DIVIDE 0x6F
112 F1 key {VK 112} VK_F1 0x70
113 F2 key {VK 113} VK_F2 0x71
114 F3 key {VK 114} VK_F3 0x72
115 F4 key {VK 115} VK_F4 0x73
116 F5 key {VK 116} VK_F5 0x74
117 F6 key {VK 117} VK_F6 0x75
118 F7 key {VK 118} VK_F7 0x76
119 F8 key {VK 119} VK_F8 0x77
120 F9 key {VK 120} VK_F9 0x78
121 F10 key {VK 121} VK_F10 0x79
122 F11 key {VK 122} VK_F11 0x7A
123 F12 key {VK 123} VK_F12 0x7B
124 F13 key {VK 124} VK_F13 0x7C
125 F14 key {VK 125} VK_F14 0x7D
126 F15 key {VK 126} VK_F15 0x7E
127 F16 key {VK 127} VK_F16 0x7F
128 F17 key {VK 128} VK_F17 0x80
129 F18 key {VK 129} VK_F18 0x81
130 F19 key {VK 130} VK_F19 0x82
131 F20 key {VK 131} VK_F20 0x83
132 F21 key {VK 132} VK_F21 0x84
133 F22 key {VK 133} VK_F22 0x85
134 F23 key {VK 134} VK_F23 0x86
135 F24 key {VK 135} VK_F24 0x87
136 Unassigned {VK 136} 0x88
137 Unassigned {VK 137} 0x89
138 Unassigned {VK 138} 0x8A
139 Unassigned {VK 139} 0x8B
140 Unassigned {VK 140} 0x8C
141 Unassigned {VK 141} 0x8D
142 Unassigned {VK 142} 0x8E
143 Unassigned {VK 143} 0x8F
144 NUM LOCK key {VK 144} VK_NUMLOCK 0x90
145 SCROLL LOCK key {VK 145} VK_SCROLL 0x91
146 OEM specific {VK 146} 0x92
147 OEM specific {VK 147} 0x93
148 OEM specific {VK 148} 0x94
149 OEM specific {VK 149} 0x95
150 OEM specific {VK 150} 0x96
151 Unassigned {VK 151} 0x97
152 Unassigned {VK 152} 0x98
153 Unassigned {VK 153} 0x99
154 Unassigned {VK 154} 0x9A
155 Unassigned {VK 155} 0x9B
156 Unassigned {VK 156} 0x9C
157 Unassigned {VK 157} 0x9D
158 Unassigned {VK 158} 0x9E
159 Unassigned {VK 159} 0x9F
160 Left SHIFT key {VK 160} VK_LSHIFT 0xA0
161 Right SHIFT key {VK 161} VK_RSHIFT 0xA1
162 Left CONTROL key {VK 162} VK_LCONTROL 0xA2
163 Right CONTROL key {VK 163} VK_RCONTROL 0xA3
164 Left MENU key {VK 164} VK_LMENU 0xA4
165 Right MENU key {VK 165} VK_RMENU 0xA5
166 Windows 2000/XP: Browser Back key {VK 166} VK_BROWSER_BACK 0xA6
167 Windows 2000/XP: Browser Forward key {VK 167} VK_BROWSER_FORWARD 0xA7
168 Windows 2000/XP: Browser Refresh key {VK 168} VK_BROWSER_REFRESH 0xA8
169 Windows 2000/XP: Browser Stop key {VK 169} VK_BROWSER_STOP 0xA9
170 Windows 2000/XP: Browser Search key {VK 170} VK_BROWSER_SEARCH 0xAA
171 Windows 2000/XP: Browser Favorites key {VK 171} VK_BROWSER_FAVORITES 0xAB
172 Windows 2000/XP: Browser Start and Home key {VK 172} VK_BROWSER_HOME 0xAC
173 Windows 2000/XP: Volume Mute key {VK 173} VK_VOLUME_MUTE 0xAD
174 Windows 2000/XP: Volume Down key {VK 174} VK_VOLUME_DOWN 0xAE
175 Windows 2000/XP: Volume Up key {VK 175} VK_VOLUME_UP 0xAF
176 Windows 2000/XP: Next Track key {VK 176} VK_MEDIA_NEXT_TRACK 0xB0
177 Windows 2000/XP: Previous Track key {VK 177} VK_MEDIA_PREV_TRACK 0xB1
178 Windows 2000/XP: Stop Media key {VK 178} VK_MEDIA_STOP 0xB2
179 Windows 2000/XP: Play/Pause Media key {VK 179} VK_MEDIA_PLAY_PAUSE 0xB3
180 Windows 2000/XP: Start Mail key {VK 180} VK_LAUNCH_MAIL 0xB4
181 Windows 2000/XP: Select Media key {VK 181} VK_LAUNCH_MEDIA_SELECT 0xB5
182 Windows 2000/XP: Start Application 1 key {VK 182} VK_LAUNCH_APP1 0xB6
183 Windows 2000/XP: Start Application 2 key {VK 183} VK_LAUNCH_APP2 0xB7
184 Reserved {VK 184} 0xB8
185 Reserved {VK 185} 0xB9
186 Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ';:' key {VK 186} VK_OEM_1 0xBA
187 Windows 2000/XP: For any country/region, the '+' key {VK 187} VK_OEM_PLUS 0xBB
188 Windows 2000/XP: For any country/region, the ',' key {VK 188} VK_OEM_COMMA 0xBC
189 Windows 2000/XP: For any country/region, the '-' key {VK 189} VK_OEM_MINUS 0xBD
190 Windows 2000/XP: For any country/region, the '.' key {VK 190} VK_OEM_PERIOD 0xBE
191 Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key {VK 191} VK_OEM_2 0xBF
192 Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key {VK 192} VK_OEM_3 0xC0
193 Reserved {VK 193} 0xC1
194 Reserved {VK 194} 0xC2
195 Reserved {VK 195} 0xC3
196 Reserved {VK 196} 0xC4
197 Reserved {VK 197} 0xC5
198 Reserved {VK 198} 0xC6
199 Reserved {VK 199} 0xC7
200 Unassigned {VK 200} 0xC8
201 Unassigned {VK 201} 0xC9
202 Unassigned {VK 202} 0xCA
203 Unassigned {VK 203} 0xCB
204 Unassigned {VK 204} 0xCC
205 Unassigned {VK 205} 0xCD
206 Unassigned {VK 206} 0xCE
207 Unassigned {VK 207} 0xCF
208 Unassigned {VK 208} 0xD0
209 Unassigned {VK 209} 0xD1
210 Unassigned {VK 210} 0xD2
211 Unassigned {VK 211} 0xD3
212 Unassigned {VK 212} 0xD4
213 Unassigned {VK 213} 0xD5
214 Unassigned {VK 214} 0xD6
215 Unassigned {VK 215} 0xD7
216 Unassigned {VK 216} 0xD8
217 Unassigned {VK 217} 0xD9
218 Unassigned {VK 218} 0xDA
219 Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key {VK 219} VK_OEM_4 0xDB
220 Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key {VK 220} VK_OEM_5 0xDC
221 Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key {VK 221} VK_OEM_6 0xDD
222 Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key {VK 222} VK_OEM_7 0xDE
223 Used for miscellaneous characters; it can vary by keyboard. {VK 223} VK_OEM_8 0xDF
224 Reserved {VK 224} 0xE0
225 OEM specific {VK 225} 0xE1
226 Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard {VK 226} VK_OEM_102 0xE2
227 OEM specific {VK 227} 0xE3
228 OEM specific {VK 228} 0xE4
229 Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key {VK 229} VK_PROCESSKEY 0xE5
230 OEM specific {VK 230} 0xE6
231 Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT, SendInput, WM_KEYDOWN, and WM_KEYUP {VK 231} VK_PACKET 0xE7
232 Unassigned {VK 232} 0xE8
233 OEM specific {VK 233} 0xE9
234 OEM specific {VK 234} 0xEA
235 OEM specific {VK 235} 0xEB
236 OEM specific {VK 236} 0xEC
237 OEM specific {VK 237} 0xED
238 OEM specific {VK 238} 0xEE
239 OEM specific {VK 239} 0xEF
240 OEM specific {VK 240} 0xF0
241 OEM specific {VK 241} 0xF1
242 OEM specific {VK 242} 0xF2
243 OEM specific {VK 243} 0xF3
244 OEM specific {VK 244} 0xF4
245 OEM specific {VK 245} 0xF5
246 Attn key {VK 246} VK_ATTN 0xF6
247 CrSel key {VK 247} VK_CRSEL 0xF7
248 ExSel key {VK 248} VK_EXSEL 0xF8
249 Erase EOF key {VK 249} VK_EREOF 0xF9
250 Play key {VK 250} VK_PLAY 0xFA
251 Zoom key {VK 251} VK_ZOOM 0xFB
252 Reserved {VK 252} VK_NONAME 0xFC
253 PA1 key {VK 253} VK_PA1 0xFD
254 Clear key {VK 254} VK_OEM_CLEAR 0xFE
  Espaçador Espaçador    


More information







Visitas acumuladas em todas as páginas:
Visitas hoje só nesta página: