Shortcut target data in .lnk files

(imported topic written by SystemAdmin)

Lee or other helpful person,

I’ve been trying to use the shortcut key phrase as described in this thread “

https://www.ibm.com/developerworks/forums/thread.jspa?threadID=407898&tstart=2115

” with very odd results. Let me try to explain and I apologize ahead of time for being so verbose. I am using the fixlet debugger, TEM client 8.2.1093.0, I am an administrator and I am on Windows 7. I am trying to return the shortcut pathname and argument (if any) for all user’s desktops.

If I use this code (same as yours, but using “Users” folder instead of “Documents and Settings” folder:

(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 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

"

I get all the links under “C:\users\all users”, but

none

of the links under any particular user, including my own user “C:\Users\AMM4629”. Then at the end of the returned data I get “E: Singular expression refers to nonexistent object.”

If I modify the code by changing the search folder to “C:\Users\AMM4629” like this:

(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 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\AMM4629

"

All that is returned is “E: Singular expression refers to nonexistent object.”.

If I modify the code by changing the search folder to “C:\Users\AMM4629\desktop” like this:

(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 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\AMM4629\desktop

"

I get all the links back on my desktop and no errors, just like I want, except I want the results of all users, not just mine.

Even if I use something very simple like this:

(name of it, pathname of it, pathname of shortcut of it) of find files “*.lnk” of (it; descendant folders of it) of folders “C:\Users”

Everything under C:\Users\All Users is returned, but not under the individual users folders.

I hope you can help shed some light on this for me.

Thanks,

Ed

(imported comment written by Lee Wei)

The Relevant itself appears to be legit.

If you run into a file with a problem, then the processing will be halted.

The reason you are seeing “All Users” is because a file in “All Users” is likely to be the problem, and the query stopped.

A likely scenario is that a .lnk file is not a real shortcut, so it does not have the “pathname of shortcut” and “start in pathname of shortcut” properties.

This statement might get around the problem and show the culprit.

(
    pathname of it, 
    (if (exists shortcut of it) then (pathname of shortcut of it) else ("Not a shortcut")), 
    (if (exists shortcut of it) then (start in pathname of shortcut of it) else ("Not a shortcut"))
) of descendants whose 
(
    (name of it as lowercase contains ".lnk") 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"

Lee Wei

(imported comment written by SystemAdmin)

Lee,

You were exactly right. Putting in these qualification checks not only provided a working solution, but also showed me where and why the logic was bombing. In our case it was some curious .lnk files being created by a Symantec application process.

Thanks for your excellent advice and guidance!

Regards,

Ed Ammendola