Error: Unable to write inside TEMP environment variable path

I was having this issue on Windows 7 64-bit and the following solution is what worked for me (via http://igordcard.blogspot.com/2012/03/unable-to-write-inside-temp-environment.html):

Why
To understand why this error was happening, I went to my TEMP folder and read the log from the PostgreSQL installer: C:\Users\myuser\AppData\Local\Temp\bitrock_installer.log

Which mentioned an interesting detail:
Input Error: There is no script engine for file extension ".vbs".

So, I picked up another file from the TEMP folder, the actual script used by the installer:
C:\Users\myuser\AppData\Local\Temp\prerun_checks.vbs

And tried to run it through the console using cscript:
Input Error: There is no script engine for file extension ".vbs".

I researched a bit more and discovered that the type of file associated with the vbs extension had been changed. In my case, by Notepad++. After I installed Notepad++, I associated some file extensions with it (including vbs), thus causing problems when detecting the type of the script (which shouldn't happen).

Solution
Run regedit, navigate to HKEY_CLASSES_ROOT\.vbs and change the (Default) key back to the string VBSFile. In my case it had been previously altered to Notepad++_file.


Go to:

Regedit =>
  HKEY_CURRENT_USER =>
    Software =>
      Microsoft =>
       Windows Script Host =>
         Settings =>
          Enabled 
  1. Double Click in Enabled.
  2. Change Value Data from 0 to 1
  3. Click Ok

enter image description here


Solve by the following steps

  1. Check that the problem is related to Windows Script Host

  2. From cmd run wscript.exe

  3. If you get an error Windows Script Host is not enabled and you can solved it by running from cmd

Fix for Current User

REG DELETE "HKCU\SOFTWARE\Microsoft\Windows Script Host\Settings" /v Enabled /f

Fix for Local Machine

REG DELETE "HKLM\SOFTWARE\Microsoft\Windows Script Host\Settings" /v Enabled /f

Now you can install psql