Crates.io | mslnk |
lib.rs | mslnk |
version | 0.1.8 |
source | src |
created_at | 2021-08-08 06:40:31.910659 |
updated_at | 2022-05-27 05:52:32.509535 |
description | create windows shortcuts (lnk files) |
homepage | |
repository | https://github.com/dobefore/mslnk.git |
max_upload_size | |
id | 433024 |
size | 57,305 |
Rust implementation to create Windows shortcut (ms shell .lnk),theoretically support WIndows 7/8/10/11. Tested on Windows 10,11.
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();
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.