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 October 2025

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.34 $59.99
Save 21%
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 Troubleshooting SharePoint: The Complete Guide to Tools, Best Practices, PowerShell One-Liners, and Scripts

Troubleshooting SharePoint: The Complete Guide to Tools, Best Practices, PowerShell One-Liners, and Scripts

BUY & SAVE
$27.00 $59.99
Save 55%
Troubleshooting SharePoint: The Complete Guide to Tools, Best Practices, PowerShell One-Liners, and Scripts
4 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
5 Learn PowerShell Toolmaking in a Month of Lunches

Learn PowerShell Toolmaking in a Month of Lunches

BUY & SAVE
$20.52 $44.99
Save 54%
Learn PowerShell Toolmaking in a Month of Lunches
6 Learn Windows PowerShell in a Month of Lunches

Learn Windows PowerShell in a Month of Lunches

BUY & SAVE
$34.99
Learn Windows PowerShell 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 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
9 Hands-On Penetration Testing on Windows: Unleash Kali Linux, PowerShell, and Windows debugging tools for security testing and analysis

Hands-On Penetration Testing on Windows: Unleash Kali Linux, PowerShell, and Windows debugging tools for security testing and analysis

BUY & SAVE
$22.26 $48.99
Save 55%
Hands-On Penetration Testing on Windows: Unleash Kali Linux, PowerShell, and Windows debugging tools for security testing and analysis
+
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.