Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

parse shortcut file (.LNK) for file path

Posted on 2006-07-19
6
Medium Priority
?
921 Views
Last Modified: 2012-08-13
Hello,
Is it possible to parse a Windows .lnk file and retrieve the file path that it points to?
I can do it in Javascript and wondering if it's possible in PHP.

Thanks for your help!
0
Comment
Question by:Caroline_Perkins
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 33

Accepted Solution

by:
snoyes_jw earned 1000 total points
ID: 17141845
Sure, it's possible. I don't know of a ready-made solution in PHP, but it should be relatively simple to translate one of the following version from Java or C:
http://javafaq.nu/java-example-code-468.html
http://www.wotsit.org/search.asp?page=24&s=ALLFILES
0
 
LVL 29

Assisted Solution

by:TeRReF
TeRReF earned 1000 total points
ID: 17141970
And as long as the PHP script and the .lnk file are on the same computer :)
0
 
LVL 29

Expert Comment

by:TeRReF
ID: 17141972
Unless you upload it of course...
0
 
LVL 7

Expert Comment

by:ed987
ID: 17145641
you could download http://84.255.238.235/lnk.exe ( it's source code http://84.255.238.235/lnk.c )
short example usage: echo `lnk.exe winzip.lnk'
and adjust path it $lnk_exe="lnk.exe";

<?
$lnk_exe="lnk.exe";
$lnk="Windows Media Player.lnk";

$ret=`$lnk_exe $lnk`;
$arr=explode('###',$ret);
if(sizeof($arr)>2)
{
 $filePath=$arr[1];
 $fileName=$arr[2];

 echo "FilePath = $filePath";
 echo "FileName = $fileName";
}
else echo "Error reading lnk ($ret)";

?>
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question