|
| 1 | +# Add PowerShell 7 to PATH in Windows |
| 2 | + |
| 3 | +This guide will help you add **PowerShell 7** (PowerShell Core) to your system’s PATH variable on Windows, so you can easily run it from any Command Prompt or Run dialog. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- You should have **PowerShell 7** installed on your machine. If you haven’t installed it yet, you can download it following the guide here: [Installing PowerShell on Windows | Microsoft Learn](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.5). |
| 8 | +- **Administrative privileges are not required** unless you're modifying system-wide environment variables. You can modify your **user-specific PATH** without admin rights. |
| 9 | + |
| 10 | +## Steps to Add PowerShell 7 to PATH |
| 11 | + |
| 12 | +### 1. Open **System Properties** |
| 13 | + - Press `Win + X` and choose **System**. |
| 14 | + - Click on **Advanced system settings** on the left sidebar. This will open the **System Properties** window. |
| 15 | + - In the **System Properties** window, click on the **Environment Variables** button at the bottom. |
| 16 | + |
| 17 | +### 2. Edit User Environment Variables |
| 18 | + - In the **Environment Variables** window, under **User variables**, find the `Path` variable. |
| 19 | + - Select the `Path` variable and click **Edit**. (If the `Path` variable doesn’t exist, click **New** and name it `Path`.) |
| 20 | + |
| 21 | +### 3. Check if PowerShell 7 Path is Already in PATH |
| 22 | + - Before adding the path, make sure the following path is not already present in the list: |
| 23 | + ``` |
| 24 | + C:\Program Files\PowerShell\7\ |
| 25 | + ``` |
| 26 | + - If the path is already there, you don't need to add it again. |
| 27 | +### 4. Add PowerShell 7 Path |
| 28 | + - If the path is not already in the list, click **New** in the **Edit Environment Variable** window. |
| 29 | + - Add the following path to the list: |
| 30 | + ``` |
| 31 | + C:\Program Files\PowerShell\7\ |
| 32 | + ``` |
| 33 | + > **Note:** If you installed PowerShell 7 in a custom location, replace the above path with the correct one. |
| 34 | +### 5. Save Changes |
| 35 | + - After adding the path, click **OK** to close the **Edit Environment Variable** window. |
| 36 | + - Click **OK** again to close the **Environment Variables** window. |
| 37 | + - Finally, click **OK** to exit the **System Properties** window. |
| 38 | +### 6. Verify PowerShell 7 in PATH |
| 39 | + - Open **Command Prompt** or **Run** (press `Win + R`). |
| 40 | + - Type `pwsh` and press Enter. |
| 41 | + - If PowerShell 7 opens, you've successfully added it to your PATH! |
| 42 | +--- |
| 43 | +## Troubleshooting |
| 44 | +- **PowerShell 7 not opening:** Ensure the path to PowerShell 7 is entered correctly. If you're using a custom installation folder, check that the correct path is added to the `Path` variable. |
| 45 | +- **Changes not taking effect:** Try restarting your computer or logging out and logging back in for the changes to apply. |
0 commit comments