#elevated-privileges #windows

bin+lib elevator

run programs with elevated privileges on Windows

1 stable release

2.0.0 May 11, 2024
1.0.1 May 10, 2024
0.1.1 May 10, 2024
0.1.0 May 10, 2024

#1284 in Command-line interface

Download history

110 downloads per month

MIT license

11KB
99 lines

A cross-platform Rust library for running programs with elevated privileges.

This library provides functions to run programs with elevated privileges on Windows systems.

Examples

Windows

use elevator_lib::run_elevated;

// Run a program with elevated privileges on Windows
if let Err(err) = run_elevated("C:\\Windows\\System32\\notepad.exe", &["C:\\example.txt"]) {
    eprintln!("Error: {}", err);
}

elevator

This library provides functions to run programs with elevated privileges on Windows systems.

Usage

To use this library in your Rust project, add it to your Cargo.toml:

cargo add elevator

Then you can use it in your Rust code:

use elevator_lib::run_elevated;

// Example: Run a program with elevated privileges
fn main() {
    if let Err(err) = run_elevated(r#"C:\Windows\System32\notepad.exe"#, r#"C:\example.txt"#) {
      eprintln!("Error: {}", err);
    }
}

Command-line Tool

Install it using Cargo:

cargo install elevator

After installation, you can use it like this:

elevator <program_path> [args...]

For example:

elevator "C:\\Windows\\System32\\notepad.exe" arg1 arg2

License

This project is licensed under the MIT License - see the LICENSE file for details.

Dependencies

~0–36MB
~462K SLoC