Run batch file as a Windows service
In order to run one application, a batch file has to be kicked off (which does things like start Jetty, display live logs, etc). The application will work only if this batch file is running. I am hence forced to have this batch file running and not logout from the Windows server.
Can this batch file be run as a service? I am experimenting with one of the suggestions from a similar question.
NSSM is totally free and hyper-easy, running command prompt / terminal as administrator:
nssm install "YourCoolServiceNameLabel"
then a dialog will appear so you can choose where is the file you want to run.
to uninstall
nssm remove "YourCoolServiceNameLabel"
为什么不简单地将其设置为计划在启动时运行的计划任务?
As Doug Currie says use RunAsService.
From my past experience you must remember that the Service you generate will
not sure if the last one still applies ... it was one big night mare in a project I worked on some time ago.
链接地址: http://www.djcxy.com/p/18472.html下一篇: 将批处理文件作为Windows服务运行