Crates.io | windows-env |
lib.rs | windows-env |
version | 0.1.1 |
source | src |
created_at | 2024-10-12 15:08:22.314461 |
updated_at | 2024-10-13 04:52:38.078109 |
description | Easily manage Windows environment variables permanently. |
homepage | https://github.com/lxl66566/windows-env |
repository | https://github.com/lxl66566/windows-env |
max_upload_size | |
id | 1406582 |
size | 28,166 |
Easily manage Windows environment variables permanently, without the need to restart your system.
Features:
PATH
.Note:
[target."cfg(windows)".dependencies]
windows_env = "0.1.1"
cargo binstall windows-env # see cargo-binstall: https://github.com/cargo-bins/cargo-binstall
cargo install windows-env -F bin # or compile from source manually
lib usage:
fn main() -> std::io::Result<()> {
windows_env::set("TEST_ENV", "test")?;
assert_eq!(windows_env::get("TEST_ENV")?.unwrap(), "test");
windows_env::remove("TEST_ENV")?;
assert!(windows_env::get("TEST_ENV")?.is_none());
windows_env::append("TEST_ENV", "test1")?;
windows_env::prepend("TEST_ENV", "test2")?;
assert_eq!(windows_env::get("TEST_ENV")?.unwrap(), "test2;test1");
windows_env::remove_from_list("TEST_ENV", "test2")?;
assert!(windows_env::exists_in_list("TEST_ENV", "test1")?);
windows_env::remove("TEST_ENV")?;
Ok(())
}
executable binary: runs wenv -h
to see help message.