How to view advertised shortcut

5

2

I just learned about advertised shortcuts in Windows. But, I can't find any info on how to view what it's pointing at, what it will execute on double click. Is there a way to modify it, or change it's icon?

flamey

Posted 2010-04-22T11:47:20.573

Reputation: 167

Answers

1

Hugh Allen

Posted 2010-04-22T11:47:20.573

Reputation: 8 620

I ended up using programmatic way (via Perl and Win32 API), but still surprised there's no build-in Windows way to even view the target. – flamey – 2010-06-20T21:53:22.803

2

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

user66001

Posted 2010-04-22T11:47:20.573

Reputation: 1 050

0

[String]$ShortcutPath = "$([System.Environment]::GetFolderPath('CommonPrograms'))\Word 2016.lnk" 
$oMSI = New-Object -ComObject 'WindowsInstaller.Installer'
$oMSIShortcutProperties = $oMSI.ShortcutTarget($ShortcutPath)
$oMSI.ComponentPath($oMSIShortcutProperties.StringData(1), $oMSIShortcutProperties.StringData(3))

Returns: C:\Program Files (x86)\Microsoft Office\Office16\WINWORD.EXE

Grace Solutions

Posted 2010-04-22T11:47:20.573

Reputation: 1