Install and Uninstall Windows Service using batch scripts

In this article, you can learn how to Install and Uninstall Windows Service using command line batch scripts (.bat) which makes your task easy.


The windows service applications which are created using .NET Framework, uses the command line utility InstallUtil.exe to install and uninstall the services. This tool is usually available in under Microsoft .NET framework installation path. The version number can be vary.

C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe

How to: Install and uninstall Windows services using command line:

To install .NET service, you need to run the below command by using command-prompt by specifying the full path of the .NET service application.


InstallUtil “D:\MyApp\MyService.exe”

To Uninstall .NET service you need to run the below command by using command-prompt by specifying the full path of the .NET service application.


InstallUtil /u “D:\MyApp\MyService.exe”

How to: Install and Uninstall Windows Service using batch scripts:

However, Installing and uninstalling Windows services using command line is usually performed manually. This involve, opening the windows command prompt, navigating to the installutil.exe path and entering the command. So, this looks very expensive task. In order to minimize the effort, below are the two batch scripts (.bat) which does the install and uninstall windows service with single click run.

You need to save these scripts into two different files with .bat extension and run the scripts whenever needed.

Note: Always make sure that run the batch scripts (.bat) in Administrator mode in order to install/uninstall windows service.

Install Windows service batch script:

UnInstall Windows service batch script:

Note: The v4.0.30319 is the framework version.


– Article ends here –

Recommended:   Install and Uninstall Windows Service using PowerShell
Share this:

Kiran is a Software engineer by profession and Enthusiastic blogger, love to write articles on computer technology and programming. Reach him at kiran.troubleshootyourself@gmail.com.

We will be happy to hear your thoughts

Leave a reply

Troubleshootyourself
Logo
Shopping cart