Jump to content

get url fron lnk file


Recommended Posts

Hi

.url files are a different format than .lnk, so the FileGetShortCut() won't work on those. What you can try though is, since the .url's are built like INI-Files...

$url = IniRead("AutoIT.url", "InternetShortcut", "URL", "-1")
If $url = "-1" Then
    ConsoleWrite("There was an error" & @CRLF)
Else
    ConsoleWrite("The url points to: " & $url & @CRLF)
EndIf

My output from running the above is:

The url points to: http://www.autoitscript.com/

Cheers

Edited by tannerli
Link to comment
Share on other sites

Okay, this makes the whole thing a little more complicated...

In my understanding, this lnk is not targeted to an executable directly as normally, but to some function located inside shell32.dll (at least it looks like this when you open the file in a Hex-Editor and compare it to a "normal" lnk)

You also might want to compare it with a lnk generated by Microsoft Office setup, there you have a similar effect (But instead of shell32.dll, the GUID of the windows installer is called with some parameters)

I also consulted the official documentation for the lnk-format by microsoft to get a clue on this... but this document's only purpose seems to be to screw up the readers mind...

Long story short:

FileGetShortcut() fails because the target is not directly stored inside the lnkfile. The effort to read it anyway is probably beyond what you had in mind.

I for my part won't do this...

Link to comment
Share on other sites

But these are .lnk files. Specifically they are made from the renamer.

I can do what you are saying with a .url file but this is a .lnk file that has a url in it... very strange. Here is a screen shot of it for you...

I have also attached the file to this post if you'd like to take a look at it.

Posted Image

lnk file.zip

Edited by typeleven
Link to comment
Share on other sites

I created a UDF to get this type of info from a .LNK file, as well as from MSI 'advertised shortcuts'. Its confusing with SHITEMID's and PIDL and whatnot, but basically shortcuts can point to just about anything it seems. You can have them point to 'fake' folders like the Recycle Bin or a Control Panel item and whatnot. UNC links are also issues. The code's a mess right now, but I might be persuaded to put it up. It will find URL's, GUID's and UNC paths, but it won't go any deeper (like extended UNC/GUID paths)..

Link to comment
Share on other sites

Here you go: _FileGetShortcutEx

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...