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.

Powershell on Start menu

Create a backup of the PATH variable content.

Copy to Clipboard

Create a temporary Powershell variable named INCLUDE.

Set its content to the directory that you want to include on the PATH variable.

Copy to Clipboard

In our example, we want to include the following directory in the PATH environment variable.

Copy to Clipboard

List the content of the PATH variable.

Copy to Clipboard

As an example, here is the content of our PATH variable.

Copy to Clipboard

Modify the PATH environment variable to include the new directory.

Copy to Clipboard

Close this POWERSHELL command-line prompt.

Start a new POWERSHELL command-line prompt.

List the new content of the PATH variable.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

Congratulations! You are able to use Powershell to modify the PATH environment variable.