下载prunsrc
http://archive.apache.org/dist/commons/daemon/binaries/windows
设置环境变量:
ZOOKEEPER_SERVICE:服务名
ZOOKEEPER_HOME:Zoookeeper文件目录
install.bat
"%~dp0amd64prunsrv.exe" "//IS//%ZOOKEEPER_SERVICE%" ^ --DisplayName="Zookeeper (%ZOOKEEPER_SERVICE%)" ^ --Description="Zookeeper (%ZOOKEEPER_SERVICE%)" ^ --Startup=auto --StartMode=exe ^ --StartPath=%ZOOKEEPER_HOME% ^ --StartImage=%ZOOKEEPER_HOME%inzkServer.cmd ^ --StopPath=%ZOOKEEPER_HOME% ^ --StopImage=%ZOOKEEPER_HOME%inzkServerStop.cmd ^ --StopMode=exe --StopTimeout=5 ^ --LogPath=%ZOOKEEPER_HOME% --LogPrefix=zookeeper-wrapper ^ --PidFile=zookeeper.pid --LogLevel=Info --StdOutput=auto --StdError=auto
zkServerStop.cmd
set /p firstRow=<"%ZOOKEEPER_HOME%logszookeeper.pid" taskkill /pid %firstRow% /t /f