以下代码获取常规快捷方式的目标路径。
Set objShell = WScript.CreateObject("WScript.Shell")
Set objShellLink = objShell.CreateShortcut(WScript.Arguments(0))
Set objFSO = CreateObject("Scripting.FileSystemObject")
strTargetPath = objShellLink.TargetPath
If (objFSO.FileExists(strTargetPath)) Then ' A link to a file.
Set objF = objFSO.getFile(strTargetPath)
Else ' A link to a folder.
Set objF = objFSO.getFolder(strTargetPath)
End If
strFolderToOpen = """" & objF.ParentFolder & """"
strItemToSelect = """" & objF.Name & """"
某些快捷方式objShellLink.TargetPath
(例如Recycle Bin.lnk
,Control Panel.lnk
)为空。
如何获取这些快捷方式的目标路径?