Scripts for installing and uninstalling service host on Windows machine.

Need to reinstall every time the service is modified and recompiled.

InstallService.bat

@ECHO OFF

IF "%1" EQU "Quiet" GOTO INSTALL

SET /P userInput=Install AbcService service? (Y/N): 

if "%userInput%"=="Y" goto install
if "%userInput%"=="y" goto install

goto end

:install
del *.log
set path=C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319

echo Installing the AbcService  windows  service...
echo ---------------------------------------------------

InstallUtil.exe c:\AbcService\AbcServiceHost.exe

echo ---------------------------------------------------
echo Done....

:end

IF "%1" NEQ "Quiet" PAUSE

May need to modify the app.config to point the database connection to your database.

UninstallService.bat

@ECHO OFF

IF "%1" EQU "Quiet" GOTO REMOVE

SET /P userInput=Uninstall AbcService service? (Y/N): 

if "%userInput%"=="Y" goto remove
if "%userInput%"=="y" goto remove

goto end

:remove
del *.log
set path=C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319

echo Uninstalling the AbcService  windows  service...
echo ---------------------------------------------------

InstallUtil.exe /u c:\AbcService\AbcServiceHost.exe

echo ---------------------------------------------------
echo Done....

:end

IF "%1" NEQ "Quiet" PAUSE
Last modified: November 1, 2019

Author

Comments

Write a Reply or Comment