Skip to content
/ mslnk Public

Rust implementation to create Windows shortcut (ms shell .lnk)

Notifications You must be signed in to change notification settings

dobefore/mslnk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Rust implementation to create Windows shortcut (ms shell .lnk)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages