You are not logged in.
Pages: 1
Is it possible to read the target path of a windows shortcut (*.lnk)?
I searched on google but I don't find nothing useful for pascal.
Last edited by SafetyCar (2010-02-14 13:54)
If this software has helped you, consider getting your pro version. :)
Offline
I searched a bit and found this for you.
Just like the Exiv2 command-line tool can be used in a script as detailed here, you can similarly use Shortcut.exe to do the same.
The relevant command to be called from the script would be: Shortcut /f:"Shortcut to Movie.lnk" /a:q | find "TargetPathExpanded"
This will give you something like TargetPathExpanded=C:\Downloads\Movie File.avi, so you just need to extract what you want (path, file name etc.) from that string.
Hope this helps!
Offline
OK, I made it work
var
Command, Output, TargetPath: string;
begin
Command := 'Shortcut.exe /F:"'+Filepath+ '" /A:Q';
ExecConsoleApp(Command, Output);
TargetPath := ReplaceRegEx(Output, '^.+\r\nTargetPathExpanded=([^\r]+)\r\n.+$', '$1', False, True);
FileName := WideExtractBaseName(TargetPath) + '.lnk';
end.
Thanks a lot
Last edited by SafetyCar (2010-02-15 00:26)
If this software has helped you, consider getting your pro version. :)
Offline
Great work guys!
I might add this feature as a meta tag later on.
Offline
Pages: 1