简体   繁体   中英

windows service - start service using batch file using task scheduler on windows 2012 server R2

I have created a batch file startservice.bat to start a windows service and scheduling this batch files using task scheduler on windows server 2012 R2.

startservice.bat

NET START myservice

But after scheduler runs a cmd pop up comes but service is not actually started.

If I run this batch file manually then service starts.

Thanks.

On my 2012 R2 server, I attempted to reproduce the problem you describe. The batch file always starts the service when I run via a scheduled task and I never get a cmd pop up.

Your question did not specify scheduled task settings. You may need to enable the " Run with highest privileges " option on the General tab of your scheduled task.

Your action should call the batch file directly or you can call CMD. Either way, make sure you call the full path of the batch file.

cmd /c C:\startservice.bat

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM