Reputation: 101
I've been trying to install the 64bit version of PostgreSQL 9.2 for Windows on my machine (Windows 7 64bit) and get this error:
The environment variable COMPSPEC does not seem to point to the cmd.exe or there is a trailing semi colon present.
I've installed it as Administrator.
I disabled the antivirus (Microsoft Security Essentials) and the firewall.
Running:
"%COMSPEC%" /C "echo test ok"
returned test ok
I've checked my System Environment Variables for trailing semi colon and I couldn't find any.
I then installed the 32bit version and managed to get to the end of the install with a different error message stating: Problem running post-install step. Installation may not complete correctly Error reading the C:\Program Files (x86)\PostgreSQL\9.2\data\postgresql.conf
but there is no postgresql.conf
file in that directory. It did install the application and when I try to connect the server with the red X on it it says fail at the bottom and it won't connect after I type in my password.
How can I connect to this server connection?
Upvotes: 10
Views: 35061
Reputation: 1
First find the path to cmd.exe(mostly it is C:\Windows\System32\cmd.exe). Go to the enviornment variable and add this path to system variable path.And also create new variable in user variable called ComSpec and add this path as value. And you are ready to go.
Upvotes: -1
Reputation: 51
Open Environment Variables, you can do this on Windows 7 by typing environment variables
in the Search program and files bar when pressing the start button at the bottom left of the desktop. And create a new System Variable(in the 'System Variable' instead of 'User Variable' section).
In the variable name, enter ComSpec
and then in the variable value , enter C:\Windows\system32\cmd.exe
.
That's all. Hope it works! Alternative fix:
If you already got the ComSpec
variable in the System Variable section, remove the ;
at the end of it this should fix it.
Upvotes: 0
Reputation: 1
What worked for me after trying to enter the commandline given her in cmd.exe I found it was named cmd1.exe in system32.. so i copied the file and renamed it as cmd.exe and installation finished
Upvotes: 0
Reputation: 41
If the installer exe is on a network share that mapped drive might actually not be accessible to the installer as it runs as administrator. This can often happen in some virtual machine arrangements such as running windows in a parallels VM. Copy the installer to a local drive first and you won't have a problem.
Upvotes: 0
Reputation: 25349
Just open Advanced System Settings in Control Panel and create a new System Variable( in the System Variable
instead of User Variable
section).
In the variable name, enter ComSpec
and then in the variable value , enter C:\Windows\system32\cmd.exe
.
If you have already the ComSpec
variable in the System Variable section, remove the ;
at the end of it this should fix it.
Upvotes: 3
Reputation: 2096
In my case , the Installer was in %USERPROFILE%\DownloadsP{ Windows download folder}, I moved the installer to desktop and ran again. weird it worked lol.
Upvotes: 1
Reputation: 563
just do it run as administrator and change the environment system variable like create a new variable 'ComSpec' and value type 'C:\Windows\system32\cmd.exe'.
Upvotes: 0
Reputation: 201
ComSpec is a generic error message for any installation failure.
Identifying the problem
Script stderr: '"C:\Users\XXXXX\AppData\Local\Temp\POSTGR~1\TEMP_C~1.BAT"' is not recognized as an internal or external command, operable program or batch file.
Error running
C:\Users\XXXXX\AppData\Local\Temp/postgresql_installer_47b21c4ea1/temp_check_comspec.bat :
'"C:\Users\XXXXX\AppData\Local\Temp\POSTGR~1\TEMP_C~1.BAT"' is not recognized as an internal or external command,operable program or batch file.
This is a problem with '8.3 file names and directories' (e.g. '\Postgres Install' -> '\POSTGR~1') Microsoft article on disabling 8.3 file names and directories: https://support.microsoft.com/en-gb/kb/121007
Execute following command to change the format based on your drive or all drives
Sample commands:
fsutil 8dot3name set 1" - disable 8dot3 name creation on all volumes
fsutil 8dot3name set C: 1" - disable 8dot3 name creation on c:
Execute the installation as a user having admin privileges
Hope it solves the problem!
Upvotes: 20
Reputation: 7494
I'm running Windows Server 2003 R2, and I have been unable to resolve this problem with the installer, so I resorted to using the binary PostgreSQL package. Hopefully this will be an alternative for others who do not want to perform an OS reinstall.
First, some background (hopefully useful to the developers)
It started out with the postgres service failing to start (the server had been running reliably for over a year). I assumed it was a corrupted PostgreSQL installation, so I uninstalled and attempted to reinstall. I encountered the following error:
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.
However, the COMSPEC variable is set properly, verified with:
echo %COMSPEC%
C:\WINDOWS\system32\cmd.exe
and:
"%COMSPEC%" /C "echo test ok"
test ok
Since this is Windows Server 2003, there is no UCA wrapper around the Administrator account, so that is not causing the problem.
Manual Installation
NET USER postgres /ADD
C:\pgsql\bin\initdb.exe -U postgres -A password -E utf8 -W -D C:\pgsql\data
runas /user:postgres "C:\pgsql\bin\pg_ctl -D C:/pgsql/data -l C:/pgsql/logfile.txt start"
Upvotes: 0
Reputation: 3813
I had a similar problem. After installation, the data folder contained no postgres.conf file. It only contained a single folder named "pg_log". I described the solution that I used here: Postgres Installation Error reading file postgresql.conf
Basically, it would be helpful to check if the user has full permissions for the postgres folder, and run "init_db" and "pg_ctl start" commands again. If the path contains a space character, try using a relative path for the pg_ctl data folder argument.
Upvotes: 0
Reputation: 36
I got the same problem, and i found in the log:
Script stderr: 'C:\Users\S300' is not recognized as an internal or external command, operable program or batch file.
Error running C:\Users\S300 (i5)\AppData\Local\Temp/postgresql_installer_56caeadbd6/temp_check_comspec.bat : 'C:\Users\S300' is not recognized as an internal or external command, operable program or batch file.
I change in User Variables TEMP to D:\TEMP and TMP to D:\TEMP. And Solved My Problem.
Upvotes: 1
Reputation: 324265
It's not COMPSPEC
it's just COMSPEC
. Please show the output of:
echo %COMSPEC%
Note that COMSPEC
could be set to something different in the Administrator account you're running the installer as. I'm not sure how to find that out, but it might appear in the PostgreSQL installer log, so please upload that and link to it in your post. See Reporting an installation error for info on where to get the installer log.
See the PostgreSQL for Windows FAQ entry Check the COMSPEC
environment variable.
Here's a report I made suggesting that the installer should test for this explicitly and here's my blog post on the topic.
Upvotes: 1