To set Postgresql path to the environment variable in Windows 11 | 10; Simply type environment in the window search bar and click on it, after clicking on the Advanced tab, select Environment Variables, and set the PostgreSQL path under System Variables by clicking on Edit and selecting New path, then setting the path to your PostgreSQL DB and save it.
If you have installed Postgresql in your Windows system. But if you do not set the path to PostgreSQL in the system environment variable, you may see ‘PSQL’ is not recognized as an internal or external command operable program or batch file’ error on the Windows 11 | 10 command line or CMD.
How to Set Environment Variables for postgresql in windows 11 | 10
Steps on how to set PostgreSQL path on system environment variables in windows 11 | 10:
Step 1 – Open Windows Search Bar
To open windows search bar and type Environment Variables; as shown below picture:
Step 2 – Select Environment Variables Window
Click advance tab setting and after that click on environment variable; as shown below picture:
Step 3 – Edit System Environment Variable Path
Edit system environment variable path; as shown below picture:
Step 4 – Set Postgresql Environment Variable Path Windows
To set Postgresql path in an environment variable on Windows, Click on New, add path, and save it; as shown below picture:
Step 5 – Restart Windows
Restart your Windows 11|10 system.
Conclusion
To set the PostgreSQL path to a system environment variable in Windows, type Control Panel on the navigation search bar > Type Edit system environment variables > Click on the “Advanced” tab > click “Environment Variables” > Click on Edit button under system variable > Select “New” button > Set the path to the postgresql bin directory > And click on “OK” button to save all the updates.