CodeSteps

Python, C, C++, C#, PowerShell, Android, Visual C++, Java ...

How to update the Target value of Windows Shortcuts?

Some times it is required to edit the Windows Shortcuts to update the shortcut to point to new location/program. But Windows will not allow to edit the disabled shortcuts (it is not possible to update the Target value through Properties window manually). We can write simple VBS (Visual Basic Scripting) to update the shortcuts to point to the new location/program.

Following steps explain how to update a Windows Shortcut through VB Script:

Step (1) Write the following VB script to update the Windows Shortcut. Save the script into .VBS file. Ex: test.vbs

Set sh = CreateObject("WScript.Shell")
Set shortcut = sh.CreateShortcut("<<SHORTCUT NAME>>.lnk")
shortcut.TargetPath = "<<FULL PATH OF THE LOCATION (OR) PROGRAM NAME>>"
shortcut.Save

Note: Where <<SHORTCUT NAME>> is the name of the shortcut. <<FULL PATH OF THE LOCATION (OR) PROGRAM NAME>> is the complete path of the location/program you want to give to the Windows shortcut.

Step (2) Once you are done with VBS changes, double click on .VBS file to execute (or) open Command prompt and type your .VBS file prefixed with @ symbol at command prompt. Ex: @test.vbs

Step (3) You can notice that the Windows Shortcut is updated with the new Traget value once you run the .VBS file.

This is the way you can update the Windows Shortcuts using .VBS script. This will work on disabled shortcuts also.

How to update the Target value of Windows Shortcuts?

Leave a Reply

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

Scroll to top