Tuesday 7 November 2017

Install or UnInstall Windows Service With or Without using Visual Studio Command Prompt

Using Visual Studio Command Prompt:-
Install:-
Go to "Start" >> "All Programs" >> "Microsoft Visual Studio 2012" >> "Visual Studio Tools" then click "Developer Command Prompt for VS2012".
Type the following command:   cd <physical location of your TestWindowService.exe file>
in my case it is :
cd C:\Sandbox\WindowServices\TestWindowService\TestWindowService\bin\Debug
Next type the following command:
InstallUtil.exe “TestWindowService.exe” and press Enter.
UnInstall:-
Go to "Start" >> "All Programs" >> "Microsoft Visual Studio 2012" >> "Visual Studio Tools" then click "Developer Command Prompt for VS2012".
Type the following command: cd <physical location of your TestWindowService.exe file>
in my case it is :
cd C:\Sandbox\WindowServices\TestWindowService\TestWindowService\bin\Debug
Next type the following command:
InstallUtil.exe /u “TestWindowService.exe” and press Enter.

Without Using Visual Studio Command prompt:-
In Certain Situation we don't have Visual Studio installed in certain System or in Server so that there is no "Developer Command Prompt" exist. But in each System Command Prompt Exists. So we can use Comman Prompt in each and every System to Install as well as UnInstall Windows Service.
Install:-
sc create TestWindowService binpath=  "C:\Sandbox\WindowServices\TestWindowService\ TestWindowService\bin\Debug\TestWindowService.exe" and press enter.
Note:- Please make sure that there should be one Space present after binpath=
UnInstall:-

sc delete TestWindowService

0 comments:

Post a Comment