Wednesday, October 26, 2011

How to Start and Stop PostgreSQL Service (Actually, Any Service) on Windows 7

On Windows XP, if you were logged in as a user with administrative rights, you could simply run cmd to start what in the old days we used to call a "DOS box" and run something like this:
    NET START postgresql
    NET STOP postgresql
from the Windows command prompt to start or stop PostgreSQL database server (or any other Windows service).

On Windows 7, however, it is a little more complicated than that. The problem is that, if you simply run cmd and try to start or stop a service, you will most probably get this error message:
System error 5 has occurred.
Access is denied.