Jump to content
Sign in to follow this  

Converting .lnk Shortcuts to Linux Launcher

Recommended Posts


I am trying to write an application to convert a Microsoft windows shortcut .lnk that references a .exe directory into a linux launcher that references that same directory file. All I need to know how to do is extract the location data from a .lnk shortcut. I can take care of the rest. I just can't find solid information anywhere on how this can be done. .lnk files are obfuscated if viewed in a text editor, I can see the obfuscation of the link and my brain can make out the directory, but I don't know how to make an application do this.



Share this post

Link to post
Share on other sites

Thanks, I didn't realize that function existed, is that relatively new?

One more thing How do I modify the text of a variable for example if [ $file = chrome.lnk ]then how do I make $file = "/chrome.lnk" without actually just saying $file = "/chrome.lnk", modifying it like (I know this doesn't work) [ $file = " + / + $file + " ]

Here is my code so far:

If Not _FileCreate("C:\Users\workingtext.txt") Then

MsgBox(4096,"Error", " Error Creating/Resetting log. error:" & @error)


; Shows the filenames of all files in the current directory.

$search = FileFindFirstFile("*.lnk*")

; Check if the search was successful

If $search = -1 Then

MsgBox(0, "Error", "No files/directories matched the search pattern")



While 1

$file = FileFindNextFile($search)

If @error Then ExitLoop

$details = FileGetShortcut(@DesktopDir & $file) <--Problem, this should be format "\place" but instead with $file is place alone no "\" exist

_FileWriteFromArray("C:\Users\workingtext.txt", $details, 0, 1) <------Problem because the above $details is incorrectly formatted for proper return

_ReplaceStringInFile("C:\Users\workingtext.txt", "C:\", "\home\")


; Close the search handle


Hopefully you can see what I'm doing. Trying to search for .lnk file in a directory (desktop for now) then right all those arrays to a text file one line each, then convert them by changing C:\ to my desired new location in the text file. Next comes write one line at a time to new text files, if 500 lines then 500 new text files. Then I will edit the .txt files for my needs(easy enough to do).

Share this post

Link to post
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
Sign in to follow this