Reputation: 584
Is it possible to create a Windows Scheduled Task from a Windows batch file with another batchfile as a parameter:
For eg : schtasks.exe /create /tn "taskName" /tr "%Home%\bin\bootstrap.cmd" /sc DAILY /st 00:01:00 /ri 1 /du 0023:59 %schTaskAccountArgs%"
Background
The batch file 'bootstrap.cmd'
in the script above has calls to other batchfiles and eventually an exe. It creates a scheduled task in the Microsoft console which triggers the same exe, but in my case due to a GPO policy, the scheduled task couldn't be created (policy being-not able to store passwords for the user that runs the scheduled job). As a workaround I want to create a service in the same Batch file by replacing the above by:
sc create "service for taskName" start= demand displayname= "service for taskName" binpath= "%Home%\bin\bootstrap.cmd"
is it a feasible method to create a service for this scenario.
Upvotes: 0
Views: 125
Reputation: 841
Windows appears to not run .bat (and .cmd) files as services.
Here are some alternatives:
Upvotes: 1