Use this command to install ruster-env with WinGet:
winget install --id=AshokSK.ruster-env -e
Ruster-Env is a high-performance environment variable management tool designed for Windows users, offering seamless integration with PowerShell and Command Prompt. It enables developers to load, set, unset, and manage environment variables directly within their current terminal session, mimicking the functionality of source .env on Linux but optimized for Windows.
Key Features:
Session Persistence: Variables remain active throughout your terminal session, ensuring they are available for all subsequent commands without reloading.
Safety Rails: The --no-overwrite flag protects critical system variables like PATH and USERNAME from accidental overwrites.
Smart Interpolation: Supports variable expansion within .env files, allowing dynamic values based on other defined variables.
Clean Unload: Quickly remove environment variables added by a specific .env file without restarting your terminal.
Zero Dependencies: Built as a single Rust binary with no external runtime requirements.
Audience & Benefit:
Ideal for developers working in Windows environments who need to manage environment variables efficiently. Ruster-Env streamlines workflow by providing a reliable, cross-shell solution that enhances productivity and reduces friction when managing project-specific configurations. Its performance and ease of use make it a valuable tool for anyone relying on environment variables in their development process.
Ruster-Env can be installed via winget, ensuring quick setup and integration into your development environment.
README
ruster-env
> Bend the environment to your will.
A blazingly fast, session-persistent environment variable manager built specifically for Windows (PowerShell & CMD).
ruster-env injects variables directly into your current terminal session, making them available for every subsequent command you run—just like source .env on Linux.
Features
Session Persistence: Variables stay loaded until you close the terminal.
Windows First: Native support for PowerShell and Command Prompt.
Safety Rails:--no-overwrite protects your system PATH and other critical variables.
Paste the copied command into the file and save it.
Restart PowerShell.
> [!TIP]
> Alternatively, run the copied command in your current powershell session to start using it immediately.
Command Prompt (CMD)
No extra setup required if the folder is in your PATH. The ruster-env.cmd wrapper handles everything automatically.
Usage
1. Load Variables
Injects variables from .env into your current session.
ruster-env load
Result:API_KEY is now available in your shell.
Options:
--verbose: See exactly what is being set.
--no-overwrite: Skips variables that already exist in your system (e.g., prevents hijacking USERNAME).
2. Set / Unset Single Variables
Quickly add or remove a single variable for the current session.
# Set a variable
ruster-env set DATA=Production
# Remove a variable
ruster-env unset DATA
3. Show Variables
Checks what is actually live in your system.
ruster-env show
List Mode: Prints all active system variables (hides internal Windows vars like =::).
Single Mode: Prints just the value (perfect for scripts).
# Copy DB URL to clipboard
ruster-env show DB_URL | clip
4. Run (Ephemeral)
Runs a single command with variables loaded, without modifying your current shell.
# Run a command with variables loaded from .env.test file (default=.env) isolated to that process
> ruster-env run --path .env.test -- python -c "import os; print(os.environ['WELCOME_MSG'])"
Hello World!
# Verify the variable did NOT leak into the current session
> ruster-env show WELCOME_MSG
Error: Variable 'WELCOME_MSG' is not set in the current environment.
5. Unload
Removes variables defined in your .env file from the session.
ruster-env unload
.env Syntax
ruster-env supports a robust syntax superset:
# Comments are supported
PORT=8080
HOST=localhost
# Quotes are stripped automatically
SECRET_KEY="super_secret_value"
SINGLE_QUOTES='works_too'
# Interpolation (References other variables)
# Order matters! Define base vars first.
DATABASE_URL=postgres://${HOST}:${PORT}/mydb