What this error means
When you type psql in Command Prompt or PowerShell after installing PostgreSQL and see this:
It means Windows cannot find psql.exe because the PostgreSQL bin directory is not in your PATH. The fix is straightforward: add the bin folder to PATH and open a new terminal.
Open a new terminal window
The installer adds PostgreSQL to your PATH, but this change only affects new terminal sessions. Any Command Prompt or PowerShell that was open before or during the install will not see the update.
psql --version. This fixes the problem in 80% of cases.Add PostgreSQL to PATH via System Properties
- 1
Open Environment Variables
Press Win+S → search Edit environment variables for your account → click it. Or: right-click This PC → Properties → Advanced system settings → Environment Variables.
- 2
Edit the Path variable
In the User variables section, click Path → Edit → New.
- 3
Add the PostgreSQL bin folder
Type the path to your PostgreSQL bin directory. For version 18 the default is:
C:\Program Files\PostgreSQL\18\binAdjust the version number if you installed 16 or 17. Click OK on all dialogs.
- 4
Open a new terminal and verify
C:\> psql --versionpsql (PostgreSQL) 18.3C:\> where psqlC:\Program Files\PostgreSQL\18\bin\psql.exe
Add to PATH via Command Prompt
setx does not affect the current terminal session. Always open a new Command Prompt after running setx.Add to PATH via PowerShell
PATH fix questions
I added to PATH but psql still not found
8\ not \).Where is psql.exe located?
C:\Program Files\PostgreSQL\{version}in\psql.exe. If you changed the install directory during setup, look there instead. You can search with: dir /s /b "C:\Program Files\psql.exe"Do I need to add the bin path to System variables or User variables?
psql to work for all users on the machine (including services and scheduled tasks), add it to System variables instead, which requires Administrator rights.