I am creating a scheduled task from command line:
schtasks /Create /SC ONSTART /TN "Zookeeper server" /TR D:\Zookeeper\zookeeper-3.4.6\bin\zkServer.cmd /RU System /V1 /f
The issue is that the "Stop task if running for X days" options is always checked. I tried unchecking it, but it always comes back on right away. Since it's a server, I want it to be able to run for more than 3 days.
I saw a solution where you had to export the xml of the task, change the value manually (ExecutionTimeLimit), delete the task and create it from the xml template, but that doesn't work either.
I also thought that it was a mandatory option for a ONSTART trigger, so I tried to replace it with a one time only trigger, the same thing happens.
Is there a way to make sure my app is run on startup (without a user logged in)? Still allowing the user to stop and start it as he pleases.
I know about services, but I heard it was kind of hard to make a service from an app with java.
EDIT: I would prefer to fix that issue, but if that's not possible, a way to install Zookeeper Server as a service. I tried with nssm 2.23, but there is no way to install a service silently (it must be done without user interface).