Skip to main content
TopMiniSite

Back to all posts

How to Set $Env:path In Powershell?

Published on
2 min read
How to Set $Env:path In Powershell? image

Best PowerShell Environment Path Tools to Buy in January 2026

1 Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools

Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools

BUY & SAVE
$47.81 $59.99
Save 20%
Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools
2 Beginner’s Guide to PowerShell Scripting: Automate Windows Administration, Master Active Directory, and Unlock Cloud DevOps with Real-World Scripts and Projects

Beginner’s Guide to PowerShell Scripting: Automate Windows Administration, Master Active Directory, and Unlock Cloud DevOps with Real-World Scripts and Projects

BUY & SAVE
$0.99
Beginner’s Guide to PowerShell Scripting: Automate Windows Administration, Master Active Directory, and Unlock Cloud DevOps with Real-World Scripts and Projects
3 Learn Windows PowerShell in a Month of Lunches

Learn Windows PowerShell in a Month of Lunches

BUY & SAVE
$42.68 $44.99
Save 5%
Learn Windows PowerShell in a Month of Lunches
4 PowerShell for Sysadmins: Workflow Automation Made Easy

PowerShell for Sysadmins: Workflow Automation Made Easy

BUY & SAVE
$28.99
PowerShell for Sysadmins: Workflow Automation Made Easy
5 AWS Tools for PowerShell 6: Administrate, maintain, and automate your infrastructure with ease

AWS Tools for PowerShell 6: Administrate, maintain, and automate your infrastructure with ease

BUY & SAVE
$48.99
AWS Tools for PowerShell 6: Administrate, maintain, and automate your infrastructure with ease
6 Learn PowerShell Scripting in a Month of Lunches

Learn PowerShell Scripting in a Month of Lunches

BUY & SAVE
$49.09
Learn PowerShell Scripting in a Month of Lunches
7 PowerShell Advanced Cookbook: Enhance your scripting skills and master PowerShell with 90+ advanced recipes (English Edition)

PowerShell Advanced Cookbook: Enhance your scripting skills and master PowerShell with 90+ advanced recipes (English Edition)

BUY & SAVE
$37.95
PowerShell Advanced Cookbook: Enhance your scripting skills and master PowerShell with 90+ advanced recipes (English Edition)
8 Windows PowerShell Pocket Reference: Portable Help for PowerShell Scripters

Windows PowerShell Pocket Reference: Portable Help for PowerShell Scripters

BUY & SAVE
$29.00
Windows PowerShell Pocket Reference: Portable Help for PowerShell Scripters
9 Learn PowerShell Toolmaking in a Month of Lunches

Learn PowerShell Toolmaking in a Month of Lunches

BUY & SAVE
$44.55
Learn PowerShell Toolmaking in a Month of Lunches
+
ONE MORE?

To set the $env:path variable in PowerShell, you can use the following command:

$env:path = "C:\path\to\directory;$env:path"

Replace "C:\path\to\directory" with the directory path you want to add to the $env:path variable. This command will append the specified directory to the end of the existing $env:path variable.

What is the default value of $env:path in Powershell?

The default value of the $env:path variable in Powershell is the system PATH environment variable, which contains a list of directories where the operating system looks for executable files.

How to add environment variables to $env:path in Powershell?

To add environment variables to $env:path in Powershell, you can use the following command:

$env:Path += ";C:\path\to\your\new\directory"

Replace "C:\path\to\your\new\directory" with the actual path to the directory you want to add to the $env:path variable. This command appends the specified directory to the existing $env:path variable.

How to revert changes made to $env:path in Powershell?

To revert changes made to the $env:path variable in Powershell, you can either:

  1. Close and reopen the Powershell session: When you close the current Powershell session and open a new one, the $env:path variable will be reset to its original state.
  2. Reset the $env:path variable manually: You can reset the $env:path variable manually using the following command: $env:path = [System.Environment]::GetEnvironmentVariable("Path", "Machine")
  3. Set the $env:path variable to its original value: If you know the original value of the $env:path variable, you can set it back using the following command: $env:path = "original-path-value"

By using any of these methods, you can revert changes made to the $env:path variable in Powershell.