Wednesday, September 17, 2014

How to install a Windows service from the command prompt

Installing a Windows service from the command prompt is a fairly simple task, only a few steps to follow.


  1. Build the project in Release mode
  2. Go to the Release folder and copy the full address from the address bar
  3. Open Visual Studio Command Prompt (On Windows 7 you can find it under Start - All programs - Visual Studio - Visual Studio Tools; on Windows 8 click start and start typing Visual Studio Command Prompt )*
  4. Install the service using the command installUtil and passing the path you copied at step 2: installUtil pathToFolder

If the service is already installed you will need to uninstall it first:
installUtil /u pathToFolder

*If on the machine where you need to install it you don't have Visual Studio, you will have to find the executable installUtil. On my Windows 8 (but I believe it is the same on Windows 7) it is in C:\Windows\Microsoft.NET\Framework\v4.0.30319


No comments:

Post a Comment