Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

Hotkey Property

Assigns a key-combination to a shortcut, or identifies the key-combination assigned to a shortcut.

                      object.Hotkey = strHotkey

object

WshShortcut object.

strHotkey

A string representing the key-combination to assign to the shortcut.

The syntax of strHotkey is:

[KeyModifier]KeyName
KeyModifier

Can be any one of the following: ALT+, CTRL+, SHIFT+, EXT+.

Note Note:

EXT+ means "Extended key." — it appears here in case a new type of SHIFT-key is added to the character set in the future.

KeyName

a ... z, 0 ... 9, F1 F12, ...

The KeyName is not case-sensitive.

A hotkey is a combination of keys that starts a shortcut when all associated keys are held down at the same time.

  • Hotkeys can be used to start shortcuts located on your system's desktop and in the Windows Start menu.

    Note Note:

    Another name for a hotkey is a Keyboard Shortcut.

In Windows 2000, valid Hotkeys always begin with CTRL + ALT.

Applies To:

The following example demonstrates the use of the HotKey property.

<package>
   <job id="vbs">
      <script language="VBScript">
         set WshShell = WScript.CreateObject("WScript.Shell")
         strDesktop = WshShell.SpecialFolders("Desktop")
         set oShellLink = WshShell.CreateShortcut(strDesktop & "\Shortcut Script.lnk")
         oShellLink.TargetPath = WScript.ScriptFullName
         oShellLink.WindowStyle = 1
         oShellLink.Hotkey = "Ctrl+Alt+e"
         oShellLink.IconLocation = "notepad.exe, 0"
         oShellLink.Description = "Shortcut Script"
         oShellLink.WorkingDirectory = strDesktop
         oShellLink.Save
      </script>
   </job>

   <job id="js">
      <script language="JScript">
         var WshShell = WScript.CreateObject("WScript.Shell");
         strDesktop = WshShell.SpecialFolders("Desktop");
         var oShellLink = WshShell.CreateShortcut(strDesktop + "\\Shortcut Script.lnk");
         oShellLink.TargetPath = WScript.ScriptFullName;
         oShellLink.WindowStyle = 1;
         oShellLink.Hotkey = "Ctrl+Alt+e";
         oShellLink.IconLocation = "notepad.exe, 0";
         oShellLink.Description = "Shortcut Script";
         oShellLink.WorkingDirectory = strDesktop;
         oShellLink.Save();
      </script>
   </job>
</package>

Community Additions

ADD
Show:
© 2015 Microsoft