WSH » Objects » WshShortcut

The WshShortcut object represents a windows shortcut, and can be used to set the target file, command-line arguments, the icon for the shortcut, a hotkey combination, the default window style, and the default working directory. This object cannot be instantiated directly. It can only be accessed through the WshShell.CreateShortcut method.

Properties

Arguments

Syntax: object.Arguments

The Arguments property sets or retrieves a String that is the concatenation of all arguments that are to be passed to the target of the shortcut.

Description

Syntax: object.Description

The Description property sets or retrieves a String description of the shortcut. Under Windows 2000, this property corresponds to the "Comment" field that can be set when the properties of a Shortcut are viewed. Under Windows 2000, the value of this property is also displayed in a tool-tip when the mouse is held over the shortcut icon.

FullName

Syntax: object[.FullName]

The FullName property is the default property for the WshShortcut object and it returns the full path to the shortcut. This property is read only.

HotKey

Syntax: object.HotKey

The HotKey property sets or retrieves the hotkey combination for a shortcut. Although you can set this property for any valid shortcut, it only creates a usable Windows HotKey mapping if the shortcut is on the Desktop or in the Start menu. Once a valid hotkey mapping has been created, pressing the specified keys simultaneously will open the shortcut.

IconLocation

Syntax: object.IconLocation

IconLocation is a String property that sets or retrieves the location of the icon used to represent the shortcut. The string is of the form "path,index", where path is the full path to the file containing the icon, and index is the zero-based index of the icon within the specified icon file.

TargetPath

Syntax: object.TargetPath

The TargetPath property sets or retrieves the location of the file that is the target of the shortcut. The arguments that are passed to the shortcut are unaffected by the setting of this property.

WindowStyle

Syntax: object.WindowStyle

The WindowStyle property sets or retrieves how the application pointed to by the shortcut will be displayed when it is first launched. If WindowStyle is 1, then the application window will be set to its default location and size. If this property has a value of 3, the application will be launched in a maximized window, and if it has a value of 7, it will be launched in a minimized window.

WorkingDirectory

Syntax: object.WorkingDirectory

The WorkingDirectory property sets or retrieves the default working directory for the application pointed to by the shortcut. All relative paths specified in file operations are taken as being relative to the working directory.

Methods

Save

Syntax: object.Save

The Save method saves the shortcut at the location specified by the FullName property. All changes made to a shortcut object will be lost unless this method is called before destroying the object.