horus Posted October 15, 2011 Posted October 15, 2011 Hi,In the last years I had this habbit fo making shortcuts for the files that I liked or wanted to recheck later.One problem that I've discovered using this method is that in many situations windows doesn't update or doesn't find the shortcut if the file was relocated.For example, on computer A in folder X I have file Y and shortcut Z that points to file Y. If I move folder X to computer B, the Y shortcut would be completely useless, as the drive and paths would change from computer A to B. Imagine that you have thousands of shortcuts like this one. You can't update them manually. in order to use a relative path.Most of my shortcuts are located in the same folder as the file that is pointed to, however, there are a few exceptions.I want to overcome this problem because I'm planning to move lots of files and their corresponding shortcuts to a NAS server.I've searched the internet for workarounds for this issue but I couldn't find anything. People are not very affected about this issue and there isn't any third party software.Hypothesys: 99% if not all of the files that I have shortcuts for are files that I wouldn't edit/modify. The only thing that I'd do to them would be to rearrange, relocate, or in worst case, rename.But the file would remain untouched.What I have in my mind: A shortcut that retains some info about the file: original name(just in case, not necesarily needed), hash value, file size.Question:What would be the smartest way to achieve this? Is there any available software that could help me out?I could do it with AutoIT and Perl, but this out take me some time as I'm not an experienced programmer.I've seen that AutoIT has some functions that can help me add a description to the shortcut where I could store the hash, name, size:http://www.autoitscript.com/autoit3/docs/functions/FileCreateShortcut.htmhttp://www.autoitscript.com/autoit3/docs/functions/FileCreateShortcut.htmI'd need a script that updates existing shortcuts with the hash/size, and one that updates the target if the pointed file was relocated.The problem is whether this description field is stored inside the .lnk file or not. Why do I ask this? I don't know much but I've read something about storing metadata, and if I recall correctly it stated something like this:In WinXP the metadata is stored outside of the file, so it would be lost when copying the file to another system.In Win7 the metadata is stored inside.The NAS server would use ZFS, and a BSD based OS and I don't know if it stores that description field.All in all, I'd prefer to skip over writing these scripts, if there is some software that helps me out with keeping shortcuts updated.
Glenn9999 Posted November 25, 2011 Posted November 25, 2011 As I understand it, there's a "resolve" function that is exposed by the "Find Target" option. Setting the "relative path" is helpful for this function, though I really haven't looked into the best way to set that. Really though, for links to work from the OS side, it really is good that you stick to their common format.The only other suggestion I can make is getting into the API for this (IShellLink) and then setting things and try the Resolve function. Or do the search yourself for file names then rewrite the information based on what you find (assuming you didn't rename or delete anything). As long as there's nothing too identical, it should be relatively easy to work out.
jaclaz Posted November 25, 2011 Posted November 25, 2011 Something like this? http://jacquelin.potier.free.fr/ShortcutsSearchAndReplace/But wouldn't it be easier to use an approach like:http://community.spiceworks.com/scripts/show/298-change-shortcut-lnk-target-paths-in-bulkYou can also try with just copying shortcuts and then "fix" them, using this one (that supports command line):http://www.nirsoft.net/utils/shman.htmlbut cannot say what happens with "name conflicts" or how fast/convenient it can be.(I mean are we talking of tens, hundreds or thousands .lnk files?)jaclaz
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now