VB script to modify shortcut properties

As part of application repackaging, you need to update some of the properties of an application shortcut as post install action of an installer. Below is the code that can be used to auto update the shortcut properties as needed.

[code language=”vb”]
Set sh = CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")

FSO.DeleteFile("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\PowerGUI\PowerGUI.lnk")
Set shortcut = sh.CreateShortcut("C:\ProgramData\Microsoft
\Windows\Start Menu\Programs\PowerGUI\PowerGUI.lnk")

shortcut.TargetPath = "C:\Program Files\PowerGUI\AdminConsole.exe"
shortcut.Arguments = "-auto none"
shortcut.WindowStyle = 7

shortcut.Save

[/code]

Leave a Reply

Your email address will not be published. Required fields are marked *