editlinks.vbs (week #25)

Wednesday, June 19, 2013 Labels: ,
This utility modifies specified shortcut (.lnk) file's paths, including the target, directory, icon, and sometimes description.

There is no usage information provided by the script itself, so here it is:

  editlinks.vbs [/s] [--path C:\path] "replace" "with" ["replace" "with"] ...

This will update all paths:
  • Target — the application linked to
  • Start in — the starting directory
  • Icon — the location of the icon
It will also empty the description property/field if it matches (exactly) the Target.

Here is an example:

    $ editlinks.vbs --path "C:\new-bin" "C:\old-bin" "C:\new-bin"

This will change all shortcuts that point to 'C:\old-bin' to point instead to 'C:\new-bin'.

NOTE: When retrieving the TargetPath from a shortcut, it will (sometimes?) expand any environment variables already in it. This will cause the number of changed files to seem quite large (and never go down).

Check out the source code at GitHub!
Older Post Home Newer Post