Running Shortcut Link Files and ShortcutInfo
Keywords: Shortcut LNK files shortcuts shellexecute shortcutinfo
Question:
Why can't I run my shortcut LNK file with the Run command?
Answer:
You need to run your shortcut with the ShellExecute command, when
your LNK files don't point to EXEs in the target directory.
Other considerations:
If your directory path is soft-coded in your LNK file, as in
"%systemdir%\Progra~1\Micros~1\Office\Outlook.EXE", then Winbatch may not
be able to run the shortcut as is. If you can run the shortcut when
you hard-code the target directory information in the shortcut, but not with
the %systemdir% variable,
try to first extract the target directory information with the ShortcutInfo
function. Then expand the %systemdir% directory, and try to run it again with
the Run function.
Question:
I am writing a program to convert shortcut properties. I create a file that contains a list
of all shortcuts under the windows directory. I then read each entry in this file and use
ShortInfo to capture the command line to check if this is the shortcut that I wish to
modify.
All of this works fine until I come across a short cut file such as
"c:\windows\sendto\3<
a=ShortCutInfo("C:\Windows\Menu Démarrer\shortcut to winver.exe.lnk")
Message("A",a)
Can anybody confirm this problem or provide a workaround?
Answer:
Your example works for me.
I think that maybe it is not the special characters, but that the
file or drive the shortcut
points to is not ready. I think it is trying to verify the target of the shortcut...
I would be careful
with FileNameShort as it probably returns the short filename of the file that is linked to,
not the link itself.
When you run it in debug, check the return values very very carefully. Make sure you
are not getting fooled by pointers to the
real file (The FileNameShort will do that).
Article ID: W13850
Filename: Running Shortcuts and ShortcutInfo.txt
File Created: 1999:04:15:16:56:48
Last Updated: 1999:04:15:16:56:48