#lnk #unicode #shell-link

bin+lib lnk

A Rust library to parse and write Windows shortcut files (.lnk)

9 releases (5 breaking)

new 0.6.1 Apr 30, 2025
0.6.0 Apr 30, 2025
0.5.1 Jan 11, 2023
0.4.1 May 16, 2022
0.1.0 Oct 29, 2019

#613 in Text processing

Download history 217/week @ 2025-01-11 142/week @ 2025-01-18 117/week @ 2025-01-25 164/week @ 2025-02-01 198/week @ 2025-02-08 260/week @ 2025-02-15 198/week @ 2025-02-22 332/week @ 2025-03-01 275/week @ 2025-03-08 275/week @ 2025-03-15 149/week @ 2025-03-22 203/week @ 2025-03-29 176/week @ 2025-04-05 128/week @ 2025-04-12 83/week @ 2025-04-19 337/week @ 2025-04-26

782 downloads per month
Used in 6 crates

MIT license

125KB
2K SLoC

Shell Link parser and writer for Rust

Works on any OS - although only really useful in Windows, this library can parse and write .lnk files, a shell link, that can be understood by Windows.

To get started, see the docs.rs documentation.


lib.rs:

Shell Link parser and writer for Rust.

Works on any OS - although only really useful in Windows, this library can parse and write .lnk files, a shell link, that can be understood by Windows.

To get started, see the ShellLink struct.

The full specification of these files can be found at Microsoft's Website.

Read Example

A simple example appears as follows:

use lnk::ShellLink;
use lnk::encoding::WINDOWS_1252;
// ...
let shortcut = lnk::ShellLink::open("tests/data/test.lnk", WINDOWS_1252).unwrap();
println!("{:#?}", shortcut);

Write Example

A simple example appears as follows:

use lnk::ShellLink;
// ...
ShellLink::new_simple(std::path::Path::new(r"C:\Windows\System32\notepad.exe"));

IMPORTANT!: Writing capability is currently in a very early stage and probably won't work!

Dependencies

~5–16MB
~286K SLoC