Modify the Pathname of a Shortcut

(imported topic written by MBARTOSH)

Is it possible to modify the pathname of a shortcut using a fixlet?

I found this relevance to find the shortcuts that need to be changed, but now I am stuck with how to modify the pathname of the shortcut.

Here is what I am using to find the shortcuts.

(pathname

of

it,

pathname

of

shortcut

of

it,

start in pathname

of

shortcut

of

it
)

of

descendants

whose

(((name

of

it

as

lowercase

contains

“.lnk”
)

and

(Pathname

of

shortcut

of

it

as

lowercase

contains

“profox”

as

lowercase))

and
((pathname

of

it

as

lowercase

contains

“\quick launch”
)

or

(pathname

of

it

as

lowercase

contains

“\start menu”
)

or

(pathname

of

it

as

lowercase

contains

“\desktop”
)

and

not
( pathname

of

it

as

lowercase

contains

“\startup”
)))

of

folder

“C:\Users”

(imported comment written by martinc)

Just looking at the relevance, I am not sure you would want to run that as it would be very slow. On my test, it took about 20 secs for the relevance to complete in the debugger.

What I would recommend is that you write a fixlet that does the following:

  1. Run a dir to get a list of all .lnk files and pipes it to a log file. I would use the “dir /b /s c:\Users*.lnk”

  2. Use a VBS script to read the log file and fix the LNK file.

Now I am not sure on the requirements, so this is about all I can give you at this time. If you have some additional requirements, I (or others) could help you with this more.

For a VBS script to modify the shortcuts, take a look at:

http://bigfix.me/fixlet/details/720

Hope that helps

(imported comment written by jgstew)

The
descendants
inspector is very expensive, and should be avoided, or if needed, used in as minimal of scope as possible.

This should be MUCH faster, but for Users start menu only:

(pathname of it, pathname of shortcut of it, start in pathname of shortcut of it) of descendants whose(name of it as lowercase ends with “.lnk”) of folders “AppData\Roaming\Microsoft\Windows\Start Menu” of folders of folder “C:\Users”

Here is the above generalized for Desktop, Start Menu, QuickLaunch:

(pathname of it, pathname of shortcut of it, start in pathname of shortcut of it) of descendants whose(name of it as lowercase ends with “.lnk”) of (folders “Desktop” of it;folders “AppData\Roaming\Microsoft\Windows\Start Menu” of it;folders “AppData\Roaming\Microsoft\Internet Explorer\Quick Launch” of it) of folders of folder “C:\Users”

Here is the above filtering for only “profox”:

(pathname of it, pathname of shortcut of it, start in pathname of shortcut of it) of descendants whose(name of it as lowercase ends with “.lnk” AND (pathname of shortcut of it as lowercase contains “profox”)) of (folders “Desktop” of it;folders “AppData\Roaming\Microsoft\Windows\Start Menu” of it;folders “AppData\Roaming\Microsoft\Internet Explorer\Quick Launch” of it) of folders of folder “C:\Users”

The above relevance should work for WinVista or later, tested on Windows 8.

Any ideas on how to (re)write the target of an existing shortcut?

(I still get sad when I see Michael’s username.)