WSH » WshShortcut » 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.

Specifying an invalid value for this property will not cause an error. However, the icon that will be displayed for the shortcut may be changed. Setting this property to the empty string restores the shortcut's default icon.

Examples

Code:
objShell = WScript.CreateObject("WScript.Shell")
objShtCut = objShell.CreateShortcut
    ("C:\\Documents And Settings\\DevGuru\\Desktop\\Shortcut To Test.vbs.lnk") objShtCut.IconLocation = "C:\\winnt\\system32\\shell32.dll,3"
objShtCut.Save()
WScript.Echo(objShtCut.IconLocation)
Output:
C:\WINNT\system32\shell32.dll,3
Explanation:

This JScript code sets the icon for a shortcut called "Shortcut to Test.vbs.lnk" to the 4th icon (since the icons are zero-indexed) in the shell32.dll file.

Language(s): JavaScript