Home:ALL Converter>Running psql on windows

Running psql on windows

Ask Time:2022-01-04T01:48:51         Author:Aaron

Json Formatter

I need to run a shell script on windows that has psql commands. I installed bash and can run the script but the psql commands are failing. So, I installed the PostgreSQL on the windows machine in this location - "C:\Program Files\PostgreSQL\14\scripts\". There is a bat file in here named runpsql.bat that opens a psql shell. I can connect to my database when I run that bat file but how do I get it to do it from the shell script? Currently, my shell script has commands like -

psql -d db -U user etc but those throw a PSQL: Command not recognized error

Author:Aaron,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/70569607/running-psql-on-windows
yy