Search code examples
psqlwindows-terminal

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?


Solution

  • 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