Batch Script to Install or Uninstall a .NET Windows Service

后端 未结 10 1659
我在风中等你
我在风中等你 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

    Suggestions:

    • Make use of the environment, Windows may not be installed on C:. But you can use %WinDir%.
    • You can redirect echo to append to a file:

      echo A message >> logfile.txt

    • Keeping track of everything and convering all the edge cases can be challenging in cmd.exe, it is not a rich environment.

    • There is no consistent place for documentation. But help (from the command line) on "cmd", "if", "for", "set" and "call" covers much of avaialble syntax.
    • Set echo off at the start to see the commands as they are executed.

提交回复
热议问题