Launch script after Windows service start

大城市里の小女人 提交于 2019-12-24 12:25:42

问题


I would like to launch script after windows service start or restart. Like monitor wsupdate and at start or restart execute a batch script test.bat

Any ideas ?


回答1:


That could be easily done with a scheduled task:

You just need to:

1) Start and Stop the Service to got the appropriate Events in the Eventlog.

2) taskschd.msc and create a new Costum Task. As Trigger you can select the Events created before with the start and/or stop action.

3) As Action call your cmd/bat, whatever you want.

Hint: You also can export the Event in the XML Format, explained here: http://blogs.technet.com/b/askds/archive/2011/09/26/advanced-xml-filtering-in-the-windows-event-viewer.aspx and then import the XML Snippet into the Scheduld Task.



来源:https://stackoverflow.com/questions/31606840/launch-script-after-windows-service-start

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!