For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > January 2008 > Re: 答复: is there a way to read content









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: 答复: is there a way to read content
Rob Dixon

2008-01-26, 10:09 pm

Tom Phoenix wrote:
> 2008/1/25 Chen Yue <godsarmycy@gmail.com>:
>
>
> 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_W...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;
}


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com