Batch Script to Install or Uninstall a .NET Windows Service

后端 未结 10 1547
我在风中等你
我在风中等你 2021-01-31 05:13

I have no experience writing batch scripts, but I was wondering if there was a way to install a .NET Windows service using installutil.exe using such a script, or u

10条回答
  •  时光说笑
    2021-01-31 05:57

    @echo off
    
    SET PROG="c:\YourServiceLocation\Service.exe" SET FIRSTPART=%WINDIR%"\Microsoft.NET\Framework\v" SET SECONDPART="\InstallUtil.exe" SET DOTNETVER=4.0.30319 IF EXIST %FIRSTPART%%DOTNETVER%%SECONDPART% GOTO install
    
    GOTO fail :install ECHO Found .NET Framework version %DOTNETVER% ECHO Installing service %PROG% %FIRSTPART%%DOTNETVER%%SECONDPART% %PROG% GOTO end :fail echo FAILURE -- Could not find .NET Framework install :param_error echo USAGE: installNETservie.bat [install type (I or U)] [application (.exe)] :end ECHO DONE!!! Pause
    

    run this bat file as administrator

提交回复
热议问题