Get the location of an advertised shortcut

Installers can create so called Advertised Shortcuts in the Start Menu. I wanted to check the Target Path of such an shortcut but Explorer doesn’t show it:

Microsoft Visio 2010 Properties | Shortcut Properties | Target Path

But we can easily retrieve the path using a small VB Script:

Option Explicit
Dim WshShell : Set WshShell = WScript.CreateObject("Wscript.Shell")
Dim objShortcut : Set objShortcut = WshShell.CreateShortcut(WScript.Arguments(0))
WScript.Echo("Target Path  : " & objShortcut.TargetPath & vbCrLf & _
"Icon Location: " & objShortcut.IconLocation)

Set objShortcut = Nothing
Set WshShell = Nothing

The scripts accepts the shortcut filename as a parameter so you can simply drag the shortcut to the script and it will show the Target Path and Icon Location:

Target Path  : C:\WINDOWS\Installer\{90140000-0057-0000-0000-0000000FF1CE}\visicon.exe |Icon Location: C:\WINDOWS\Installer\{90140000-0057-0000-0000-0000000FF1CE}\visicon.exe,0

Bonus Chatter: if you want to prevent an installer from creating Advertised Shortcuts set the DISABLEADVTSHORTCUTS MSI property to 1 (MsiExec /I MyMsi.msi DISABLEADVTSHORTCUTS=1).