We will compile the ways to add the directory to the PATH environment variables in Windows:
- Using GUI
- Using Command line
Let’s get started!
Method 1: Setting PATH Environment Variable Using Windows GUI
Utilize the below-listed steps for setting a directory as a PATH environment variable using Windows GUI.
Step 1: Select Directory
Select and open the directory you want to add in PATH Environment Variables:
Step 2: Copy Directory Path
Copy the Directory path. To do so, select the path from the address bar and press “CTRL+C”:
Step 3: Open Environment Variables Settings
Open the Environment Variables settings by typing “Environment Variables” in the “Startup” menu and selecting the “Edit environment variables for your account” option:
Press the “Environment Variables” button:
Step 4: Add Directory to Path
Choose the Path option from the “System variables” panel and press the “Edit” button:
Then, click the “New” button to add the copied path, press “CTRL+V” to paste the directory path, and click the “OK” button:
We have added the Directory path using GUI methods. Let’s check out how to set a Path environment variable.
Method 2: Setting PATH Environment Variable Using Windows Command Line
In order to set up the directory into the PATH environment variable using the Command Line, follow the below-given steps.
Step 1: Open Command Prompt
In the first step, run the Windows Command Prompt as an admin user using “CMD” in the “Startup” menu:
Step 2: Add Directory to Path Environment Variable
Utilize the below command and specify the address of the directory to add it to the PATH environment variable:
Step 3: Add Directory to Path Environment Variable Permanently
To permanently set a directory into the Path environment variable settings, run the “setx” command:
We have offered the GUI and Command Line methods to add the directory to a Path environment variable in Windows.
Conclusion
To add a directory to a Path environment variable in Windows, you can use Graphical User Interface or the Command Line. In the first approach, use the Control panel “Edit environment variables for your account” settings and set the directory path in the System variables panel. In the Command Line method, utilize the Windows Command Prompt and execute the “set Path=[directory_path]” command. In this blog, we have demonstrated the GUI and Command Line method to add a directory to a PATH environment variable in Windows.