9 releases

0.1.8 May 27, 2022
0.1.7 Oct 19, 2021
0.1.6 Aug 10, 2021

#96 in Windows APIs

Download history 1107/week @ 2024-12-17 551/week @ 2024-12-24 716/week @ 2024-12-31 980/week @ 2025-01-07 1234/week @ 2025-01-14 1460/week @ 2025-01-21 1099/week @ 2025-01-28 921/week @ 2025-02-04 1574/week @ 2025-02-11 1476/week @ 2025-02-18 1641/week @ 2025-02-25 1372/week @ 2025-03-04 994/week @ 2025-03-11 1579/week @ 2025-03-18 1203/week @ 2025-03-25 359/week @ 2025-04-01

4,377 downloads per month
Used in 5 crates

MIT license

55KB
937 lines

mslnk

Rust implementation to create Windows shortcut (ms shell .lnk),theoretically support WIndows 7/8/10/11. Tested on Windows 10,11.

Usage

Add this to your Cargo.toml:

[dependencies]
mslnk = "0.1.8"

examole to create lnk

use mslnk::ShellLink;

let target = r"C:\Users\Admin\Desktop\qq aa\qiuqiu.exe";
let lnk = r"C:\Users\Admin\Desktop\qq.lnk";
let sl = ShellLink::new(target).unwrap();
sl.create_lnk(lnk).unwrap();

Error handling

use mslnk::{ShellLink,MSLinkError};

fn main()->Result<(),ApplicationError> {
    let target = r"C:\Users\Admin\Desktop\qq aa\qiuqiu.exe";
    let lnk = r"C:\Users\Admin\Desktop\qq.lnk";
    let sl = ShellLink::new(target)?;
    sl.create_lnk(lnk)?;
}

entirely written in rust,no external command,support unicode string ,such as Chinese characters. Most of code are from lnk-rs for parsing and writing lnk file.

reference

Dependencies

~225–325KB