原文:
Setting Windows PATH for Postgres tools
If, after installing PostgreSQL, you face “psql not recognized as an internal or external command” error when you try to run psql from command prompt, then most probably all you need to do to solve this problem is to add the Postgres’s bin directory to the PATH system variable (the PATH is a system variable which allows Windows with the help of the Command prompt or the Terminal window find executables).
In this blog post, we’ll share seven simple steps that describe how to add the folder to the Windows 10 PATH variable.
Step 1. Run Windows Search on your Windows 10 machine by pressing WIN+S. You will see the Search Textbox.
Go to the “Advanced” tab and click on the “Environment Variables” button at the bottom. The “Performance,” “User Profiles,” and “Startup and Recovery” options can also be set in this tab.
Step 4. The “Environment Variables” window will be opened. This is divided into two boxes with User variables and System variables – where all variables and their values are displayed.
Find the “Path” variables in the System variables box, as shown in the screenshot above.
Step 5. Double click on the “Path” variable.
The list with all Path variables will be opened, where the Path variables can be edited, added, and deleted.

PS D:\Program Files\PostgreSQL\11\bin> .\psql.exe -h localhost -U postgres -d postgres 用户 postgres 的口令: psql (11.2) 输入 "help" 来获取帮助信息. postgres=# exit PS D:\Program Files\PostgreSQL\11\bin>
命令行 可以了 =》重启电脑,使得 环境变量生效
PS D:\sql> psql.exe -h localhost -U postgres -d postgres psql: 无法联接到服务器: Connection refused (0x0000274D/10061) 服务器是否在主机 "localhost"(::1) 上运行并且准备接受在端口 5432 上的 TCP/IP 联接? 无法联接到服务器: Connection refused (0x0000274D/10061) 服务器是否在主机 "localhost"(127.0.0.1) 上运行并且准备接受在端口 5432 上的 TCP/IP 联接?
启动本地 posgresql服务:
服务 =》 右键 =》启动
PS D:\> psql.exe -h localhost -U postgres -d postgres 用户 postgres 的口令: psql (11.2) 输入 "help" 来获取帮助信息. postgres=# exit PS D:\>
PS D:\sql> psql.exe -h localhost -U postgres -d postgres -f .\cbopv3_finance_orders_20211215.sql PS D:\WestWin\sql\cbopv3_finance_orders_20211215> nohup psql -h localhost:5432 -U postgres -d postgres -f .\cbopv3_finance_orders_20211215.sql nohup : 无法将“nohup”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。 所在位置 行:1 字符: 1 + nohup psql -h localhost:5432 -U postgres -d postgres -f .\cbopv3_fin ... + ~~~~~ + CategoryInfo : ObjectNotFound: (nohup:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
pg_dump.exe --verbose --host=***** --port=5432 --username=postgres --format=c --encoding=UTF-8 --inserts --no-privileges --no-owner --file D:\sql\dump-cbopvopv3-202112221038 -n "acc" -n "\"notify\"" cbopv3
pg_dump.exe --verbose --host=***** --port=5432 --username=postgres --format=c --encoding=UTF-8 --inserts --no-privileges --no-owner --file D:\sql\dump-cbopv3-report-cbopv3-202112221052 -t "report.\"FacebookAccountInfoReport\"" cbopv3 Task 'PostgreSQL dump' started at Wed Dec 22 10:52:00 CST 2021
todo:nohup