Forum Discussion
schtasks help
Hello,
I would like to create the following Scheduled Task via script:
schtasks /Create /RU User /RP Password /SC ONLOGON /TN “Task” /TR “C:\Temp\Programm.exe” /RL HIGHEST /DELAY 0001:00
2 questions:
1) Which switch do I need so that afterwards, under Properties, General, “Only execute if the user is logged on” is checked?
Now the task is created with “Execute regardless of user login”.
2) Which switch can I use to ensure that, for example, Repeat: every hour - for the duration of: 1 day, is entered (Properties, Trigger).
I have already used it with the switch /RI, but the error is displayed on execution, does not work with /SC ONLOGON and is also in the help !??
But if I go to the settings, I can change this manually.....
2 Replies
- JudeHartleyIron Contributor
For executing only if the user is logged on: Use /IT. For repeating every hour: Use /SC HOURLY with /RI, but you may consider creating separate tasks for both conditions depending on the desired behavior.
- JaxonRhodesIron Contributor
Remember to replace "User" and "Password" with the actual username and password when running these commands. Also, creating tasks that run interactively may require administrator privileges, depending on your system settings.