I stumbled upon this beautiful error when trying to re-install my PostgreSQL 9.1.3 server: Unable to write inside TEMP environment variable path.
After some research and trial-and-terror [sic], I came to the conclusion that the essence of the problem had been a tiny change I made to my system's file associations (via Notepad++).
Here's how I solved it and how you can do it too: