General approach to reading lnk files

Several frameworks and languages ​​seem to have lnk parser files (C #, Java, Python, of course, countless others) to get to their goals, properties, etc. I would like to know what is the general approach to reading lnk files if I want to parse lnk in another language that does not have the specified function. Is there any Windows API for this?

+2
source share
5 answers

Microsoft does not have an official document describing the lnk file format, but there are some documents that describe the format. Here is one of them: Shortcut File Format (.lnk)

As for the API, you can use the IShellLink interface

+3

lnk J.A.F.A.T. .

. lnk-parse-1.0.pl http://jafat.sourceforge.net

, . , Linux.

+1

@Giorgi: lnk, , : http://msdn.microsoft.com/en-us/library/dd871305%28PROT.10%29.aspx - , (45Megs) (Application_Services_and_NET_Framework.zip), , MS-SHLLINK.pdf.

?

, .

0

, WSH, .lnk windows post-XP. COM WScript.Shell Component. (, explorer.exe)

, . PHP: (PHP 5, COM-)

<?php
$wsh=new COM('WScript.Shell'); // the wsh object

// please note $wsh->CreateShortcut method actually
// DOES THE READING, if the file already exists. 
$lnk=$wsh->CreateShortcut('./Shortcut.lnk');
echo $lnk->TargetPath,"\n";

, , VBScript:

set sh = WScript.CreateObject("WScript.Shell")
set lnk = sh.CreateShortcut("./Shortcut.lnk")
MsgBox lnk.TargetPath

VB/VBS, , COM WSH .

This simple tutorial is useful because it lists and illustrates some of the most interesting properties of.lnkthe file that is different from the most important:TargetPath. It:

  • WindowStyle,
  • Hotkey,
  • IconLocation,
  • Description,
  • WorkingDirectory
0
source

All Articles