Would you like to learn how to edit the PATH environment variable using Powershell? In this tutorial, we are going to show you how to use Powershell to modify the PATH environment variable on a computer running Windows.
• Windows 2012 R2
• Windows 2016
• Windows 2019
• Windows 10
Equipment list
The following section presents the list of equipment used to create this tutorial.
As an Amazon Associate, I earn from qualifying purchases.
Related tutorial – PowerShell
On this page, we offer quick access to a list of tutorials related to PowerShell.
Tutorial Powershell – Edit the PATH environment variable
As Administrator, start a new POWERSHELL command-line prompt.
Create a backup of the PATH variable content.
Create a temporary Powershell variable named INCLUDE.
Set its content to the directory that you want to include on the PATH variable.
In our example, we want to include the following directory in the PATH environment variable.
List the content of the PATH variable.
As an example, here is the content of our PATH variable.
Modify the PATH environment variable to include the new directory.
Close this POWERSHELL command-line prompt.
Start a new POWERSHELL command-line prompt.
List the new content of the PATH variable.
Here is the command output:
Congratulations! You are able to use Powershell to modify the PATH environment variable.