安装postgresql时报错COMSPEC does not seem to point to the cmd.exe or
(认知有限,如有不妥,还望告知,欢迎讨论。)
背景
OS:windows10
安装包版本:14.4 [1]
OS 时间:北京时间
OS UI:英文(澳大利亚)
起始操作:以管理员身份运行
完整报错信息:
There has been an error.
The environment variable COMSPEC does not seem to point to the cmd.exe or there is a trailing semicolon present. Please fix this variable and restart installation.

解决方法
step1: 把OS UI转成中文简体(为了和时区保持一致),然后重启电脑。
(可能这一步是不必要的,但如果做后面的步骤不起作用的话,则最好补做第一步)
step2:通过搜索进入“查看高级系统设置”,选择“高级”标签页,点击“环境变量”,新建一个用户变量,
变量名为 COMSPEC
变量值为 <cmd.exe所在的地址的完整路径> (这个可以在搜索栏里面搜一下cmd.exe就可以找到,我这边的完整路径是 C:\Windows\System32\cmd.exe ), 配置完后点击“确定”,点击环境变量窗口中的“确定”,点击高级标签页上的“确定”。重启电脑。
step3:以管理员身份运行运行安装包即可。
=reference=
[1] https://www.enterprisedb.com/downloads/postgres-postgresql-downloads
[2] https://stackoverflow.com/questions/15287207/problems-installing-postgresql-9-2