Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add SQL Shell (psql) (postgres) to Windows Terminal

I'm trying to add a new terminal Postgres shell (psql) to the Windows Terminal. I want to add it to the profiles list in the settings.

This is the windows terminal.

windows terminal

In the settings file, we can add a list of profiles. In that list, I have Windows PowerShell, Command prompt, and Azure Cloud Shell.

How do I add psql shell on that list?

    {
          "guid": "{some guid}",
          "hidden": false,
          "name": "SQL Shell (psql)",
          "source": ?
    }

I looked up various articles on this, but none of them has a working solution.

Can anyone help me with this?

like image 571
nicks101 Avatar asked Sep 18 '25 14:09

nicks101


2 Answers

I somehow figured it out! The profile settings are:

{
    "commandline" : "\"%PROGRAMFILES%\\PostgreSQL\\12\\scripts\\runpsql.bat\" -i -l",
    "hidden": false,
    "name": "PostgreSQL",
    "icon" : "PostgreSQL.png*",
    "background" : "#1b364d",
    "cursorShape" : "vintage"
}

I also searched for the guid for some time, and then I remembered that I had added Git Bash to Windows Terminal. So I copied that executable, replaced the value with psql batch file address, and voilà!

*PostgreSQL.png

like image 120
Hrishikesh Thesserikaran Avatar answered Sep 23 '25 09:09

Hrishikesh Thesserikaran


you can get the guid down below if you want, i got it from here: https://www.postgresql.org/docs/8.3/datatype-uuid.html

"guid": "{a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11}",
"name" : "SQL psql",
"commandline": "%PROGRAMFILES%/PostgreSQL/13/scripts/runpsql.bat -i -l",
"hidden": false,
"icon": "%SystemDrive%/PROGRA~1/PostgreSQL/13/scripts/images/pg-psql.ico",
like image 25
Diaa Elgendy Avatar answered Sep 23 '25 09:09

Diaa Elgendy