Tom Phoenix wrote:
2008/1/25 Chen Yue <[EMAIL PROTECTED]>:
I fully understand this. So I wonder is there a way to get the path that the
blabla.lnk points to?
You'd think so; symbolic links have a simple implementation on
Unix-like machines. Besides, Windows itself can figure it out. Unless
Microsoft have hidden a key piece of the puzzle from us, we should be
able to do it as well.
Alas, the file format is, it seems, proprietary. Here's a reverse engineering:
http://www.i2s-lab.com/Papers/The_Windows_Shortcut_File_Format.pdf
To quote from that document:
If you're writing software under Windows I highly recommend you
use the IShellLink interface. For the DOS, Linux, JAVA and other
crowds, this is the document you need, 'cause MS isn't gonna
give you squat.
Somebody should probably make a module for that "IShellLink
interface", and pulling data from the .lnk file format probably
deserves a module of its own. Neither type of module seems to be
available on CPAN yet.
Hope this helps!
Unfortunately a Microsoft link file is an encapsulation of a
command-line instead of being a simple reference to another file. It
includes information like working directory, parameter values, and the
icon to be displayed.
There is, however, a Win32::Shortcut module in the libwin32 bundle that
I have used successfully. If all you want is the path to the linked file
then you can something like the program below.
HTH,
Rob
use strict;
use warnings;
use Win32::Shortcut;
my $file = 'C:\Documents and Settings\Rob\Desktop\Perl.lnk';
print link_path($file), "\n";
sub link_path {
Win32::Shortcut->new(@_)->Path;
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/