If you need to install your .exe file as Windows service using command prompt (not the Visual Studio command prompt) here is how you can do this in x32 and x64 versions of Windows.
Windows x32
- Run the command prompt as Administrator
- Navigate to the installutil.exe in your .NET folder (for .NET 4 it’s C:\Windows\Microsoft.NET\Framework\v4.0.30319 for example)
- Run
1 |
.\installutil.exe "c:\path to my exe\myservice.exe" |
You can also run this command with absolute path to installutil.exe like this:
1 |
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe" "c:\myservice.exe" |
Windows x64
- Run the command prompt as Administrator
- Navigate to the installutil.exe in your .NET folder (for .NET 4 it’s C:\Windows\Microsoft.NET\Framework64\v4.0.30319 for example)
- Run
1 |
.\installutil.exe "c:\path to my exe\myservice.exe" |
You can also run this command with absolute path to installutil.exe like this:
1 |
"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installutil.exe" "c:\myservice.exe" |
To uninstall Windows service run:
1 |
.\installutil.exe /u "c:\path to my exe\myservice.exe" |