leuce 2 Posted November 6, 2011 (edited) G'day everyone For what it's worth, I needed a way to extract the path of a file from an LNK file, and the following script does it. It works only on LNK files that you can see if you do a DIR command in the command prompt (some shortcuts don't seem to be LNK files). I haven't tested it extensively but it works on the files that I tested it on. The reason I wanted to do this was because I wanted to be able to copy or move a file from its current location to the locaiton of the shortcut. $fo = FileOpen ("myfile.lnk", 16) $fr = FileRead ($fo) For $i = 1 to BinaryLen ($fr) $character = BinaryMid ($fr, $i, 1) If $character = ":" Then $startpos = $i-1 ExitLoop EndIf Next For $j = $startpos to BinaryLen ($fr) $character = BinaryMid ($fr, $j, 1) If $character = "0x00" Then $endpos = $j-1 ExitLoop EndIf Next MsgBox (0, "", BinaryToString (BinaryMid ($fr, $startpos, $endpos - $startpos + 1)), 0) Samuel Edited November 6, 2011 by leuce Share this post Link to post Share on other sites
trancexx 1,013 Posted November 6, 2011 FileGetShortcut() does this for you in case you were wondering. ♡♡♡ . eMyvnE Share this post Link to post Share on other sites
leuce 2 Posted November 6, 2011 FileGetShortcut() does this for you in case you were wondering. Thanks, I should have asked, shouldn't I? Share this post Link to post Share on other sites
trancexx 1,013 Posted November 6, 2011 Thanks, I should have asked, shouldn't I? I think it's nice when people show initiative like you did with your code, regardless of necessity. ♡♡♡ . eMyvnE Share this post Link to post Share on other sites
matwachich 36 Posted November 7, 2011 Works for Shortcuts to files, not to folders And it doesn't get the commande line arguments By the way, nice example Share this post Link to post Share on other sites