How do I find the Target of an Advertised shortcut? [duplicate]
EDIT: Originally I used the title "How do I find the Target of a MS-Office shortcut?" but have since changed it as the problem is not specific to MS-Office shortcuts.
I have MSOffice 2010 OneNote installed, the shortcut in the Start menu has the following properties:
As you can see the Target
information is generic and the Find Target
button is greyed out.
How do I find the file the shortcut is pointing to?
EDIT: I was looking for the Target of the shortcut so I could use it with one of the "Favourite" keys on my Microsoft keyboard. However, in getting caught up in wanting to find the location of the Target I forgot that I could just set the favourite to point to this shortcut, not the executable.
Although that solves my issue it still leaves we wanting to know how to find the location of the Target files in Advertised shortcuts.
It appears that these are "Advertised Shortcuts" i.e. they break certain functionality such as the "Find Target" function in order to allow it to show information about the program like the Excel shortcut saying "Performs Calculations blah blah blah"
It appears to have annoyed more than a few people on the internet:
http://www.dotnetmonster.com/Uwe/Forum.aspx/vs-setup/1894/Setup-creates-shortcut-with-find-target-grayed
Ah, looks like it has been asked on SO: https://stackoverflow.com/questions/1270779/why-is-the-target-disabled-in-dot-net-shortcuts-after-setup
Try either of the below (from Tek-Tips Forums):
VbScript
' GetRealTarget.vbs
' This version needs to be run under wscript engine rather than cscript
' Pass the full path to an MSI "Advertised Shortcut" lnk file (including the extension) as a parameter
' e.g. assuming that we have a default install of Office 2003 for All Users:
' GetRealTarget "C:\Documents and Settings\All Users\Start Menu\Programs\Microsoft Office\Microsoft Office Excel 2003.lnk"
' Displays fully resolved target for the MSI shortcut
Option Explicit
Dim MSITarget
On Error Resume Next ' just some simple error handling for purposes of this example
If wscript.arguments.count = 1 Then ' did actually pass an MSI advertised shortcut? Or, at least, a parameter that could be such a thing?
With CreateObject("WindowsInstaller.Installer")
Set MSITarget = .ShortcutTarget(wscript.arguments(0))
If Err = 0 then
MsgBox .ComponentPath(MSITarget.StringData(1), MSITarget.StringData(3))
Else
MsgBox wscript.arguments(0) & vbcrlf & "is not a legitimate MSI shortcut file or could not be found"
End If
End With
End If
On Error Goto 0
PowerShell (with the install of this Windows Installer Module)
get-msiproductinfo | where { $_.ProductState -match "Installed" } | fl AdvertisedProductName, InstallLocation