PostgreSQL安装错误:环境变量COMSPEC似乎没有指向cmd.exe

Jun*_*ong 7 windows postgresql installation

我是PostgreSQL新手,当我尝试在Windows 10设备上安装PostgreSQL 13 / 14时,遇到以下错误。

"The environment variable COMSPEC does not seem to point to the cmd.exe or there is a training semicolon present. Please fix this variable and restart installation." 
Run Code Online (Sandbox Code Playgroud)

弹出错误的截图


COMSPEC 系统变量

这是我的 COMSPEC环境变量的设置


内容 installbuilder_installer.log

Log started 05/06/2022 at 17:51:52
Preferred installation mode : qt
Trying to init installer in mode qt
Mode qt successfully initialized
Setting variable whoami from C:\WINDOWS\System32\whoami 
Script exit code: 0

Script output:
 atrapa\junkwong

Script stderr:
 

Executing C:\WINDOWS\System32\icacls "C:\Users\junkwong\AppData\Local\Temp/postgresql_installer_c7c2d91f40" /inheritance:r
Script exit code: 0

Script output:
 processed file: C:\Users\junkwong\AppData\Local\Temp/postgresql_installer_c7c2d91f40
Successfully processed 1 files; Failed processing 0 files

Script stderr:
 

Executing C:\WINDOWS\System32\icacls "C:\Users\junkwong\AppData\Local\Temp/postgresql_installer_c7c2d91f40" /T /Q /grant "atrapa\junkwong:(OI)(CI)F"
Script exit code: 0

Script output:
 Successfully processed 1 files; Failed processing 0 files

Script stderr:
 

Executing C:\WINDOWS\System32\cscript //NoLogo "C:\Users\junkwong\AppData\Local\Temp\postgresql_installer_c7c2d91f40\prerun_checks.vbs"
Script exit code: 0

Script output:
 The scripting host appears to be functional.

Script stderr:
 

Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-x64-14 Base Directory. Setting variable iBaseDirectory to empty value
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-x64-14 Branding. Setting variable iBranding to empty value
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-x64-14 Version. Setting variable brandingVer to empty value
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-x64-14 Shortcuts. Setting variable iShortcut to empty value
[17:52:01] Using branding: PostgreSQL 14
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-x64-14 SB_Version. Setting variable sb_version to empty value
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-x64-14 pgAdmin_Version. Setting variable pgadmin_version to empty value
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-x64-14 CLT_Version. Setting variable clt_version to empty value
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-x64-14 Data Directory. Setting variable server_data_dir to empty value
Executing C:\Users\junkwong\AppData\Local\Temp/postgresql_installer_c7c2d91f40/temp_check_comspec.bat 
Script exit code: 0

Script output:
 

Script stderr:
 

Exiting with code 1
Run Code Online (Sandbox Code Playgroud)

而且 COMSPEC 变量确实被设置为系统变量,而不是像许多帖子建议的那样设置为用户变量。此外,没有尾随分号 (;)

我尝试过的:

  1. "%COMSPEC%" /C "echo test ok"我已经在命令提示符下运行并得到“测试正常”,结果请参见此处
  2. 在管理员 cmd 上运行安装。
  3. 安装不同版本的 PostgreSQL,包括 14.2.2、14.3.1 和 13.7.1(都会产生相同的错误消息)
  4. 尝试了 Prayash Koirala 提出的解决方案,但找不到Command Processor文件Postgresql 9.4 安装/Windows 8.1/ COMSPEC 问题
  5. 尝试安装 PostgreSQL 9.2 时出现问题。但bitrock_installer_xxxx.log建议的路径中缺少

非常感谢,如有任何帮助或建议,我们将不胜感激。

祝你有美好的一天。

问候,
康俊

小智 9

  1. 在命令提示符处运行以下命令:

    fsutil 行为设置disable8dot3 1

  2. 重新启动计算机。

这是来自https://learn.microsoft.com/en-GB/troubleshoot/windows-server/performance/stop-error-code-0x00000019的解决方案,它对我有用。


小智 1

您好,我遇到了同样的问题,但后来我将 CompSpec 的环境变量更改为名称:ComSpec 和路径:C:\Windows\system32\cmd.exe 并重新启动我的电脑,它安装成功。希望能帮助到你。