I am new to PostgreSQL and when I tried to install PostgreSQL 13 / 14 on my Windows 10 device I encountered the following error.
"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."
The screenshot of the pop up error
COMSPEC System Variable
This is the setting of my COMSPEC environment variable
The Content of the 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
And the COMSPEC variable is indeed set as a System Variable not a User Variable like many posts proposed. Also, there is no trailing semi colon (;)
What I have tried:
"%COMSPEC%" /C "echo test ok" on my command prompt and got "test ok" as result see hereCommand Processor file can be found Postgresql 9.4 installation/Windows 8.1/ COMSPEC issuebitrock_installer_xxxx.log is absent from the suggested pathThank you very much, any help or suggestions are appreciated.
Have a good day.
Regards,
Jun Kang
I faced this problem once again, and my previous answer didn't work for me this time.
I solved the problem by instead of using classic PostgreSQL installer, I set this up with a Docker.
Install Docker Desktop
https://www.docker.com/products/docker-desktop/
Start installed Docker Desktop
In PowerShell, run:
docker pull postgres
In PowerShell, run:
docker run -d -p 5432:5432 --name postgres -e POSTGRES_PASSWORD=mypassword postgres
Now you can connect to the Postgres server for example with pgAdmin on the same machine, using:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With