parse shortcut file (.LNK) for file path

Posted on 2006-07-19
Last Modified: 2012-08-13
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!
Question by:Caroline_Perkins
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
LVL 33

Accepted Solution

snoyes_jw earned 250 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:
LVL 29

Assisted Solution

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

Expert Comment

ID: 17141972
Unless you upload it of course...

Expert Comment

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

$lnk="Windows Media Player.lnk";

$ret=`$lnk_exe $lnk`;

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


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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 …

623 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