我刚刚了解了 Windows 中宣传的快捷方式。但是,我找不到任何关于如何查看它指向的内容、双击时它将执行什么的信息。有没有办法修改它或更改它的图标?
答案1
答案2
尝试以下任一方法(来自Tek-Tips 论坛):
脚本语言
' 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
电源外壳(安装此Windows 安装程序模块)
get-msiproductinfo | where { $_.ProductState -match "Installed" } | fl AdvertisedProductName, InstallLocation
答案3
[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))
返回:C:\Program Files (x86)\Microsoft Office\Office16\WINWORD.EXE