Windows 7 task command line

This command should create a task that launches a calculator window application every minute.

schtasks /Create /tn "mytask" /sc MINUTE /mo 1 /ru "myuser" /rp "mypassword" /tr "C:\Windows\System32\calc.exe" 

It works fine, tasks are being added. The task looks right. Tasks are displayed as started in the schedule, but the calculator does not light up. Exe exists, I can run it separately.

Does anyone know why I don't see a calculator?

+3
source share
2 answers

Probably because the task is not running interactively. Add the '/ it' parameter :

/ IT
The value that allows the task to run interactively only if the / RU user is currently logged in during the execution of the task. The task is only performed if the user is logged on.

Without the / it option, tasks are performed in session 0, which prevents the user from interacting. For more information, do the Session Isolation 0 web search.

+2
source

How to create, modify, and delete scheduled tasks from the command line Windows XP / Server 2003 introduced us to the SchTasks command-line tool, which usurped the At tool offered in Windows 2000. This tool offers the ability to control every aspect of your scheduled tasks by invoking this command.

While the Windows wizard uses to help you graphically create scheduled tasks, very well, a command-line tool is ideal for situations such as:

Manipulating tasks in batch scripts. Monitor and create tasks on networked computers without having to log in. Mass creation / synchronization of tasks on multiple machines. Use in custom applications to communicate with Task Scheduler instead of having to make API calls.

For example: Create "My task" to run C: RunMe.bat at 9 o'clock every day: SchTasks / Create / SC DAILY / TN "My task" / TR "C: RunMe.bat" / ST 09:00

Change “My task” at 2 pm: SchTasks / Change / TN “My task” / ST 14:00

Create "My task" to run C: RunMe.bat for the first time a month: SchTasks / Create / SC MONTHLY / D 1 / TN "My task" / TR "C: RunMe.bat" / ST 14:00

Create "My Task" to run C: RunMe.bat every weekday at 2 p.m .: SchTasks / Create / SC WEEKLY / D MON, TUE, WED, THU, FRI / TN "My Task" / TR "C: RunMe .bat "/ ST 14:00

Delete the task named "My task: SchTasks / Delete / TN" My task "

+2
source

Source: https://habr.com/ru/post/977491/


All Articles