Postgres users may encounter a “psql not recognized as an internal/external command” error while executing the SQL Shell from CMD. The primary reason that causes the stated error is that the “Windows Path for Postgres tools is not set”. To overcome this problem and to get error-free output, Postgres’s bin directory must be added to the PATH system variable.
This post presents a practical guide on how to set up Windows PATH for Postgres tools. So, let’s begin.
How to Set Windows PATH for PostgreSQL Tools?
To set the windows path for Postgres tools, you need to follow the steps listed below:
Step 1: Open the System Properties
Firstly, press the “WIN + S” button to open the windows search menu:
In the search text bar, type “Edit the System Environment Variables”, and click on the respective option when you find it:
Clicking on the “Edit the System Environment Variables” will open the “system properties”:
Step 2: Open Environment Variables Window
Once the “system properties” window is opened, select the “Environment Variables…” button under the “Advanced” tab:
Clicking on the“Environment Variables…” button will pop up a new window named “Environment variables”:
The “environment variables” window is split into two parts: “User Variables for HP” and “System Variables”.
Step 3: Set Environment Variables
Select the “Path” variable under the system variables, and click on the “Edit..” button to get the list of all Path variables:
Clicking on the “Edit…” button will lead you to a new window where you can add a new path variable, edit a path variable, or delete a path variable:
To set the windows path for Postgres tools, you need to click on the “NEW” button and specify the Postgres bin directory’s path:
Click on the “OK” button to keep all the changes.
Alright! The Windows Path for the PostgreSQL tools has been “set” successfully. Now, you can use any Postgres tool on your Windows system.
Conclusion
To set Windows PATH for PostgreSQL tools, firstly, open System Properties > open the “Environment Variable” window > select the “Path” variable under the system variables > click on the “Edit..” button > select the “NEW” button > specify the Postgres bin directory’s path > and click on the “OK” button to save all the modifications. This Post presented a practical guide on how to set the Windows Path for the Postgres tools.