Wednesday, 1 December 2010

VBS Display or List Shortcut Properties

If you want a script that lists/audits shortcut properties then the following code will come in handy.
The code below is set to display the properties of an icon xxx located on the desktop.
The code is a little strange as it trys to create an existing shortcut but this is the only method you can use to retrieve the properties of an existing shortcut as there is no Readshortcut method.

Set Shell = CreateObject("WScript.Shell")
DesktopPath = Shell.SpecialFolders("Desktop")
Set link = Shell.CreateShortcut(DesktopPath & "\xxx.lnk")
wscript.echo link.Description
wscript.echo link.TargetPath
wscript.echo link.WorkingDirectory

No comments:

Post a Comment