sunhux
asked on
Change a Windows Batch script to non-interactive Windows service that auto-starts if it detects it's down
I have a windows batch script that I would like to run as a Windows Service
(non-interactively ie it's running even before user login to Windows) &
this Service should check if it's down/not running & then auto-start
(auto-start when Windows boots up but also auto-start when the
service is down/not running).
User must not be able to set this service to shut down or Disabled or
Manual; only local administrator or domain admin can be allowed to
do this. I'm running on Win 7 & Win 10.
Appreciate a step by step instruction, thanks.
(non-interactively ie it's running even before user login to Windows) &
this Service should check if it's down/not running & then auto-start
(auto-start when Windows boots up but also auto-start when the
service is down/not running).
User must not be able to set this service to shut down or Disabled or
Manual; only local administrator or domain admin can be allowed to
do this. I'm running on Win 7 & Win 10.
Appreciate a step by step instruction, thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Easy.
Then add it as a service via NSSM
https://nssm.cc/
@ECHO OFF
:Start
REM Your batch file
REM Sleep for a minute
Timeout 60
REM Run again
Goto Start
Then add it as a service via NSSM
https://nssm.cc/
Thanks and I was happy to help you with this.
The selected answer does not answer your question.
How does
answer this?
How does
An ordinary Service can be set to Automatic and then in the Recovery tab, restart itself if it does not start the first time. Only Administrators can adjust these services.
answer this?
I have a windows batch script that I would like to run as a Windows Service
(non-interactively ie it's running even before user login to Windows) &
this Service should check if it's down/not running & then auto-start
(auto-start when Windows boots up but also auto-start when the
service is down/not running).
Reading between the lines, it seems the Recovery option may have fixed the issue without a script ... we'll see!
It cannot because it's not a service to start of with. The question is how to turn it into a service
The only question is, why do you need it? Just configure your service accordingly.