问题解决:
PostgreSQL需要一些参数才能打开
应打开在..\PostgreSQL\9.5\scripts下的runpsql.bat进入cmd。
参考runpsql.bat中的内容:
@echo off
REM Copyright (c) 2012-2016, EnterpriseDB Corporation. All rights reserved
REM PostgreSQL server psql runner script for Windows
SET server=localhost
SET /P server="Server [%server%]: "
SET database=postgres
SET /P database="Database [%database%]: "
SET port=5432
SET /P port="Port [%port%]: "
SET username=postgres
SET /P username="Username [%username%]: "
for /f "delims=" %%a in ('chcp ^|find /c "932"') do @ SET CLIENTENCODING_JP=%%a
if "%CLIENTENCODING_JP%"=="1" SET PGCLIENTENCODING=SJIS
if "%CLIENTENCODING_JP%"=="1" SET /P PGCLIENTENCODING="Client Encoding [%PGCLIENTENCODING%]: "
REM Run psql
"D:\Program Files (x86)\PostgreSQL\9.5\bin\psql.exe" -h %server% -U %username% -d %database% -p %port%
pause