tsunami

log in
history

Alter Windows Shortcuts

Luke Breuer
0001-01-01 05:00 UTC
tags: wscript

source

Save as a .js file and modify as needed.
var WshShell = WScript.CreateObject("WScript.Shell");
var shortcuts = [
    "c:\location\of\shortcut1.lnk",
    "c:\location\of\shortcut2.lnk",
    ...
];
for (var i = 0; i < shortcuts.length; ++i) {
        var pathname = shortcuts[i];
        var sc = WshShell.CreateShortcut(pathname);
        sc.TargetPath = sc.TargetPath.replace(/^[Zz]:\/,
                          "\\server\share\");
        sc.Save();
}