'psql' is not recognized as an internal or external command

12,005

Have you added the Postgres binaries to your path in windows? It would seem that this is a likely cause of your issue.

To add to your path follow these steps (pulled from https://www.java.com/en/download/help/path.xml -- yes I know it is java but the premise is the same):

  1. Windows 10 and Windows 8
  2. In Search, search for and then select: System (Control Panel)
  3. Click the Advanced system settings link.
  4. Click Environment Variables.
  5. In the section System Variables, find the PATH environment variable and select it. Click Edit.
  6. If the PATH environment variable does not exist, click New.
  7. In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable.
  8. Click OK.
  9. Close all remaining windows by clicking OK.
  10. Reopen Command prompt window, and run your java code. (in our case psql)

You would add the bin folder to your path rather than just an individual binary. For reference also see this question: How to set Postgres path variable on Windows 10

Share:
12,005

Related videos on Youtube

X-x
Author by

X-x

Updated on June 04, 2022

Comments

  • X-x
    X-x almost 2 years

    I have installed postgresql 10 on my windows 10 and added those paths

    (C:\Program Files\PostgreSQL\10\bin) , (C:\Program Files\PostgreSQL\10\lib)

    but when i go to the CMD under administration rights and test PSQL or psql --version ... i still get the same error

    'psql' is not recognized as an internal or external command
    

    i tried echo %path% and i can see the path there correct

    I'm actually trying to link Flask to Heroku database that is why i have installed Postgresql so the pc can be familiar with psql commands

  • X-x
    X-x over 5 years
    thanks a lot for replying but as i stated above that's exactly what i did and it didnt work :S , i closed the CMD port twice and reopened it with admin right
  • hgoscenski
    hgoscenski over 5 years
    Can you show your path? Also can you execute via a fully defined path?
  • X-x
    X-x over 5 years
    i dont know what do you mean by ( fully defined path ) but here is the image from my pc and the path is correct .... tinypic.com/view.php?pic=2mg2gcl&s=9#.W5gON-gzZPY
  • hgoscenski
    hgoscenski over 5 years
    You need to add bin
  • X-x
    X-x over 5 years
    yea i have just noticed but i have added it as well and it didnt work , now i have all of them added , bin , script and lib
  • hgoscenski
    hgoscenski over 5 years
    I assume you closed and reopened all cmd windows?
  • X-x
    X-x over 5 years
    yea i think it worked but only on admin rights ! , thanks alot man
  • hgoscenski
    hgoscenski over 5 years
    Awesome! I am glad to hear that, if you think my answer helped I would appreciate you accepting it, otherwise I wish you the best of luck.

Related