██╗ ███╗ ██╗██╗ ██╗ ██████╗ ███████╗ █████╗ ██████╗ ███████╗██████╗
██║ ████╗ ██║██║ ██╔╝ ██╔══██╗██╔════╝██╔══██╗██╔══██╗██╔════╝██╔══██╗
██║ ██╔██╗ ██║█████╔╝ ██████╔╝█████╗ ███████║██║ ██║█████╗ ██████╔╝
██║ ██║╚██╗██║██╔═██╗ ██╔══██╗██╔══╝ ██╔══██║██║ ██║██╔══╝ ██╔══██╗
███████╗██║ ╚████║██║ ██╗ ██║ ██║███████╗██║ ██║██████╔╝███████╗██║ ██║
╚══════╝╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════╝ ╚══════╝╚═╝ ╚═╝
open_lnk is a lightweight desktop utility that opens Windows .lnk (Shell Link) shortcut files directly on Linux (and macOS).
It is designed first and foremost for double-click / “Open with” usage, not for manual command-line interaction.
The goal is simple:
👉 You double-click a .lnk file, it opens the correct target — even if it lives on a different drive, partition, or network share.
- Overview
- How it works
- Key Features
- Prerequisites
- Installation
- Uninstall
- Usage
- Configuration files
- Limitations
- License
- Support
When a .lnk file is opened, open_lnk:
-
Parses the Windows Shell Link binary format (subset of the official Microsoft specification).
-
Extracts the most reliable target path from the available fields.
-
Translates Windows paths to Linux/macOS equivalents:
- Drive letters (
X:\...) - UNC paths (
\\server\share\...)
- Drive letters (
-
Tries multiple resolution strategies automatically.
-
Opens the resolved path or network URI using the system default handler.
If the target cannot be resolved automatically, a graphical assistant is shown to help the user select the correct mount point, and the choice is remembered for next time.
Capture.video.du.24-09-2023.01.32.40.webm
-
Parses common Shell Link fields (ANSI + Unicode):
LocalBasePath,CommonPathSuffix,RelativePathWorkingDir,Arguments,IconLocation
-
Full UTF-16LE → UTF-8 conversion (including surrogate pairs)
-
Windows path normalization (
\→/) -
Best-effort resolution with safe fallbacks
-
Opens targets via:
xdg-open(Linux)open(macOS)
Resolution order:
- Per-link cache (exact
.lnk→ mount prefix association) - User mapping file (
mappings.conf) - Automatic mount probing (
/proc/mounts, scored) - Graphical assistant (if still unresolved)
Resolution order:
- User mapping file
- GVFS mounts (GNOME)
- CIFS mounts (
/proc/mounts) - Fallback to
smb://URI (percent-encoded)
When a .lnk cannot be resolved automatically:
- A GUI dialog lists currently mounted locations
- The user selects the correct mount point (or uses a folder chooser)
- If the merged preview exists,
open_lnksaves:- A global mapping rule (drive letter or UNC share) into
mappings.conf - A per-link cache entry for this specific
.lnkfile
- A global mapping rule (drive letter or UNC share) into
This means:
- A shortcut pointing to drive A: will not interfere with one pointing to F:
- Re-opening the same
.lnkis instant - No global or dangerous assumptions are made
The cache is stored safely and updated atomically (latest-wins, no duplicates).
-
Automatically shown only when resolution fails
-
Implemented via standard desktop dialogs (
zenityor compatible tools) -
Works when launched from:
- File manager (double-click)
- “Open with”
-
No command-line interaction required for normal users
What it shows (so it’s not a black box):
- Windows prefix (server/share or drive)
- Windows suffix
- Detected Linux mount points
- A preview of the final merged path Matching is done on the prefix only.
- Clear desktop notifications on failure
- Safe fallbacks (parent directory, URI)
- Optional debug output (for developers)
- GUI runs also write a small log file:
~/.cache/windows-link-reader/open_lnk.log(or$XDG_CACHE_HOME/windows-link-reader/open_lnk.log)
- A C compiler (
gccorclang) make
- Linux:
xdg-open(fromxdg-utils) - macOS:
open(built-in)
Optional (recommended on Linux):
zenityor compatible dialog tool (graphical assistant)notify-send(desktop notifications)
You just have to run:
./setup.shYou also can run it with make
make
sudo make installWhat it does:
- Builds and installs
open_lnk - Installs desktop integration on Linux (desktop entry + icon)
- On macOS, creates a small Finder wrapper app Open LNK.app so you can use Open With / double-click (
/Applicationspreferred, fallback:~/Applications)
Run:
./uninstall.shThis removes:
open_lnkbinary (system and user locations)- Desktop entries/icons and refreshes caches (Linux, best-effort)
- macOS wrapper app (
/Applications/Open LNK.appand~/Applications/Open LNK.app) if present
No reboot required.
Normal usage (recommended):
- Double-click a
.lnkfile - Or right-click → Open with → LNK Reader / Open LNK
macOS note:
open_lnk is a command-line tool. Finder cannot list CLI binaries in Open With.
After running setup.sh, use the generated Open LNK.app wrapper to set it as default handler:
Finder → Get Info → Open with → Open LNK → Change All.
If Finder doesn't refresh the list, run: killall Finder (or log out/in).
Used for global drive / UNC mappings:
~/.config/windows-link-reader/mappings.conf
Example:
# Drive letter mapping
F:=/media/me/F_Daten
# UNC mapping
//server/share=/mnt/shareStored separately and managed automatically. No manual editing required.
- Not a full implementation of every Shell Link feature (some ExtraData blocks are ignored)
- Resolution is best-effort and depends on available mounts
- Network shares may still require authentication handled by the OS
Please open an issue on GitHub if you encounter a (real) problem or have (a useful) suggestion: https://github.com/SECRET-GUEST/windows_link_reader/issues
_ ._ _ , _ ._ _ ._ _ , _ ._ _ ._ _ , _ ._ _ ._ _ , _ .__ _ , _ ._ ._ _ , _ ._ _ , _ ._ .---. _ ._ _ , _ .__ _ , _ ._ ._ _ , _ ._ _ ._ _ , _ .__ _ , _ . .---<__. \ _
(_ ' ( ` )_ .__) (_ ' ( ` )_ .__ (_ ' ( ` )_ .__) (_ ' ___ ._( ` )_ .__) ( ` )_ .__) )_ .__)/ \(_ ' ( )_ ._( ` )_ .__) ( ` )_ .__) (_ ' ( ` )_ ._( `` )_ . `---._ \ \ \
( ( ( ) `) ) _) ( ( ( ) `) ) ( ( ) `) ) _ ( ( (o o) ) ) `) ) _ ) `) ) _ `) ) \.@-@./( ( ) `) ) `) ) _ ) `) ) _ ( ( ) `) `) ` ),----`- `.))
(__ (_ (_ . _) _) ,__) (__ (_ (_ . _) _) _ (_ (_ . _) _) ,__ (_ ( V ) _) (_ . _) _) ,_ (_ . _) _) ,_ . _) _) ,/`\_/`\ (_ ( . _) _) (_ . _) _) ,_ (_ . _) _) ,__ (_ (_ . _) _) (__. _) _)/ ,--. ) |
`~~`\ ' . /`~~` `~~`\ ' . /`~~` `~~`\ ' . /`~~` `~~`/--m-m- ~~`\ ' . /`~~` `\ ' . /`~~` `\ ' . / // _ \\ ``\ ' . /`~~`\ ' . /`~~` `\ ' . /`~~` `~~`\ ' . /`~~`\ ' . /`~~/_/ > |
; ; ; ; ; ; ; ; ; ; ; ; ; ; | \ )|_ ; ; ; ; ; ; ; ; ; ; |,\__-' |
/ \ / \ / \ / \ / \ / \ / \ /`\_`> <_/ \ / \ / \ / \ / \ / \ \__ \
________/_ __ \___________________/_ __ \___________/_ __ \______ __ ___/_ __ \____/_ __ \________/_ __ \_______/_ __ \\__/'---'\__/_/_ __ \____/_ __ \________/_ __ \_____ _______/_ __ \____/_ __ \____ __\___ )