9 releases

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

#76 in Windows APIs

Download history 1610/week @ 2024-06-15 1358/week @ 2024-06-22 1225/week @ 2024-06-29 1520/week @ 2024-07-06 1655/week @ 2024-07-13 1740/week @ 2024-07-20 1087/week @ 2024-07-27 1124/week @ 2024-08-03 1354/week @ 2024-08-10 1157/week @ 2024-08-17 1107/week @ 2024-08-24 1491/week @ 2024-08-31 1239/week @ 2024-09-07 1178/week @ 2024-09-14 1443/week @ 2024-09-21 1167/week @ 2024-09-28

5,410 downloads per month
Used in 3 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

~205–305KB