Available on Windows only.
Expand description
lnks provides a high-level API for reading and writing Windows .lnk (Shell Link) files.
It wraps the COM-based Shell APIs IShellLinkW and IPersistFile, including support for reading and toggling the undocumented “Run as administrator” flag.
§Examples
§Load an existing shortcut
let path = Path::new(r"C:\Users\Public\Desktop\Notepad.lnk");
let shortcut = lnks::Shortcut::load(path).unwrap();§Create a new shortcut
let mut shortcut = lnks::Shortcut::new(r"C:\Windows\System32\notepad.exe");
shortcut.arguments = Some(r"C:\Windows\win.ini".to_string());
let out = Path::new(r"C:\Users\Public\Desktop\Notepad.lnk");
shortcut.save(out).unwrap();Modules§
- com
- Module containing COM related utils.
Structs§
- Hotkey
- Represents a Windows shortcut hotkey.
- Icon
- Icon resource used by a Windows shortcut.
- Shortcut
- Represents a Windows shortcut (
.lnk) file. - Shortcut
Builder - Builder for
Shortcutto support ergonomic construction.
Enums§
- Error
- Top-level error type for this crate.
- Hotkey
Modifier - Hotkey modifier flags of a shortcut.
- Virtual
Key - Represents a Win32 virtual-key code.
- Window
State - Initial window display state for a launched application.
Type Aliases§
- Hotkey
Modifiers - A set of
HotkeyModifiers. - Result
- Result alias for this crates error type.