With Windows service is installed and uninstalled (by installutil.exe)

1. Install the .NET Framework ;

2. Create a text file, rename Install.bat , will replace Install.bat content for:

  C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\InstallUtil.exe  C:\\Users\\123\\Desktop\\Projects\\VerityPlatform\\Bin\\WindowsService_HardwareDevice.exe

  @cmd.exe

  Note 1: C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 for the .Net Framework installation path of;

  Note 2: WindowsService_HardwareDevice.exe own created for WCF services used to carry the Windows Installer service, created as follows:

     https://docs.microsoft.com/zh-cn/dotnet/framework/wcf/feature-details/how-to-host-a-wcf-service-in-a-managed-windows-service

  Note 3: The Role @ cmd.exe to run .bat complete without exiting to see the results.

3. Run as administrator Install.bat complete Windows service is installed.

4. Windows uninstall the service: the new text file, rename Uninstall.bat , will replace the contents of Uninstall.bat as follows:

  C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\InstallUtil.exe  /u  C:\\Users\\123\\Desktop\\Projects\\VerityPlatform\\Bin\\WindowsService_HardwareDevice.exe

  @cmd.exe

5. to run as administrator  Uninstall.bat complete uninstall Windows service.

Guess you like

Origin www.cnblogs.com/dhqy/p/12049911.html