How to add memcached to system start-up in Windows Server 2008

I have spent a whole day or two only in trying to make memcached start-up automatically on system restart in Windows 2008 Server system. I was getting this error “memcached.exe exits with Failed to ignore SIGHUP” when I tried to use the -d switch. In the end, it turned out to be pretty simple but trying to do it with Windows NT Resource Kit, PowerShell’s New-Service command, srvany.exe or the likes did NOT work at all for me. What worked for me was this:

  1. You go to Run > “RegEdit” hit enter.
  2. Then you find the key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
  3. Add a string value to it, name it whatever you want and put the full path to the memcached.exe file into the value of it.
Add memcached.exe to startup in Registry
Add memcached.exe to startup in Registry in Windows 2008 Server

Now you should be able to see the memcached startup when you reboot the system.

PS: In case you have a dependent service on memcached, change its start-up type to Automatic(delayed)