使用srvany.exe将任何程序作为Windows服务运行
学习了:http://wangye.org/blog/archives/42/
https://www.cnblogs.com/huangcong/p/5761557.html
在windows下也可以把zookeeper注册为服务启动。就是在d:www下运行: instsrv.exe zookeeper d:wwwsrvany.exe 然后写一个注册表文件。内容如下: Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServiceszookeeperParameters] "Application"="D:\www\zookeeper-3.4.12\bin\zkServer.cmd" "AppParameters"="" "AppDirectory"="D:\www\zookeeper-3.4.12"
=====================================================================
还可以带参数,redis启动的时候带的参数;
cd /d d:wwwmysql5.5in echo install mysql mysqld -install net start mysql cd /d d:www instsrv nginx d:wwwsrvany.exe instsrv php5 d:wwwsrvany.exe instsrv.exe redis d:wwwsrvany.exe regedit -s service.reg cd d:wwwmemcached memcached -d install net start memcached echo "all done"
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesNGINXParameters] "Application"="d:\www\nginx\nginx.exe" "AppParameters"="" "AppDirectory"="d:\www\nginx\" [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServices edisParameters] "Application"="d:\www\redis\redis-server.exe" "AppParameters"="d:\www\redis\redis.conf" "AppDirectory"="d:\www\redis\" [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesphp5Parameters] "Application"="d:\www\php-5.6.36\php-cgi.exe" "AppParameters"="-b 127.0.0.1:9000 -q" "AppDirectory"="d:\www\php-5.6.36\"