Microsoft® Windows® Script Host
Hotkey Property
WSH Reference
Version 1

See Also                      Applies To


Description
Provides the hotkey of a shortcut object. A hotkey is a keyboard shortcut that starts or switches to a program.
Syntax
object.Hotkey = strHotkey
Parameters
Part Description
object WshShortcut object.
strHotkey Sequence of keys to assign.
Remarks
The syntax of strHotkey is as follows, with Hotkey being case-insensitive:

Part Description
modifier "ALT+" | "CTRL+" | "SHIFT+" | "EXT+"
keyname "A" .. "Z" |
"0".. "9" |
"Back" | "Tab" | "Clear" | "Return" |
"Escape" | "Space" | "Prior" | ...

Hotkeys can activate only shortcuts located on the Windows-based desktop or the Windows Start menu.

Example
The following example creates a shortcut and assigns a hotkey to the shortcut:
Set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
Set oMyShortcut = WshShell.CreateShortcut(strDesktop & "\a_key.lnk")
OMyShortcut.TargetPath = "%windir%\notepad.exe"
oMyShortCut.Hotkey = "ALT+CTRL+F"
oMyShortCut.Save
WScript.Echo oMyShortCut.Hotkey