Меню Рубрики

Windows scheduler from command line

Schedule tasks from command line

Schedule tasks‘ is a GUI application using which we can schedule tasks, There is an equivalent utility which provides the same functionality but with the advantage that it can be used from windows command line. This command is Schtasks. This is an in-built windows command supported by XP, Vista and Windows 7. Let’s see the syntax of this command with the help of few examples.

How to schedule a task ?

If you are logged into the same computer where you want to run the scheduled task, then you can use the below command to create the task.

Now let’s see few examples.

Example 1: Schedule disk defragmentation on every Saturday at 10AM. User credentials are administrator/password.

If the specified username and password are correct, then you would get the below message when you run the above command.

If the credentials are not correct, you may get a warning like below.

If there exists a scheduled task with the same name then the error would be:

If you need to use a domain user account to run the task you can specify domainname\username with /RU option.

How to get the list of scheduled tasks?

Just run Schtasks command and you can see the list of scheduled commands.

If you want complete details about each of the tasks you can run the command ‘Schtasks /query /v

Delete a scheduled task

We can delete a schedule task using ‘schtasks /delete /TN task_name‘ command. For example, to delete the task we created in the example 1 we can run the below command.

Delete all the scheduled tasks

You can run the below command to delete all the scheduled tasks.

Disable a scheduled task

There does not seem to be a way to disable a scheduled task from command line. We can delete the tasks as mentioned above.

Modify a scheduled task:

We can change a scheduled task using ‘schtasks /change’ command. Run ‘schtasks /change /?’ for the syntax.

how to delete from the folder?

schtasks /delete /TN “Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser” /F

It is possibile to disable sheduled task. Here is an example:
schtasks /Change /TN “Microsoft\Windows\MUI\LPRemove” /Disable

How do you do it if the task is meant to be run on a DIFFERENT computer (like with the “connect to another computer”)? Thank you! On cmd please.

I’m regarding to run a batch file by a schedule task.

This script is running chrome with a specific url.

The problem is that I must choose some credential in my command line like this :
schtasks /create /sc once /tn Video_XP /tr “\\myserver\myscript.bat” /u contoso\admin /p mypassword /st 12:25:00

The problem is that the task is running with an other account than the login one.

If I replace /u by %username% i’m not able to specify the passord and the task will stuck in background requesting password.

Please tell how can I know whether a task is Enabled/Disabled using CMD queries
Please provide a Example supporting your answer.

what to add in cmd for sidebar execute properties, setting,
for this two things:
if the task fails, restart every: 30 minutes
also deselect stop the last if it runs longer den

Can I get the command to enable “Run whether user is logged in or not” option while scheduling task from command line.

Hello everybody!
I was forced to use win10 –
lot’s of automatic pop ups, reminders and other annoying stuff
called “features”. However:
My company is constructing high-level measurement devices.
(i’m doing electronics)
our win-develloper just committed suicide and i’m left with the crap…
(just kidding)
Please help me!
A pop up that wanted to update or install language-support popped up
and tried to connect to www to do some updates – Why?! The sys was running fine!
Since our devices are ment to work headless but only with a remote-access,
there will be no connection to www ever… So:
Q1) how to get win10 a bit more www-independent?

Back to the pop-ups: As a source of evel, i identified schtasks…
I don’t consider it smart, to have a let’s tidy-up-the harddrive-task starting in the bg,
or debugging when our customer just wants to shut down the system and is forced to wait.

So, what will be damaged (especially concerning wifi) when i just do
schtask /TN * /delete?

Thanks a lot for your answers!
(Sorry for my upset state…)
indigo

schtasks /Create /tn “mytask” /sc MINUTE /mo 1 /ru “myuser” /rp “mypassword” /tr “C:\Windows\System32\calc.exe”
this command does not run calculater.
Any help in this?

schtasks /Create /tn “mytask” /sc MINUTE /mo 1 /tr “C:\Windows\System32\calc.exe”

i guess you can run calc as a dif user, but no need to if youre just trying to add something. otherwise your syntax was incorrect and idk what your username and password were.
and you will want to run this after you get the above correct unless you want to see the calc open up every minute… 😉

Источник

How To Schedule Tasks From Command Line In Windows With Schtasks?

Recurring tasks are generally schedules with scheduled task manager. Scheduled task manager have GUI for management but creating a task in 20 different servers is very hard and trivial job. Windows operating systems provide tool called schtasks which is used to create, modify, delete scheduled tasks.

Help about scheduling tasks command schtasks can be printed with /? option.

Help

Syntax

While using command we will use following syntax.

Create A Scheduled Task/Job

In order to create a scheduled task we need to provide following parameters at least.

  • /SC specifies
  • /TN specifies task name which will identify task from other tasks
  • /TR specifies the tasks executable file or command.

In this example we will create a task named defrag which will run c:\windows\system32\defrag.exe at weekly periods.

Create A Scheduled Task/Job

Schtasks Attributes

While creating scheduled jobs we can providing following attributes.

  • /S system Specifies the remote system to connect to.
  • /U username Specifies the user context under which schtasks.exe
    should execute.
  • /P [password] Specifies the password for the given user context.
    Prompts for input if omitted.
  • /TN taskname Specifies which scheduled task to change.
  • /RU username Changes the user name (user context) under which the
    scheduled task has to run. For the system account,
    valid values are “”, “NT AUTHORITY\SYSTEM” or “SYSTEM”.
    For v2 tasks, “NT AUTHORITY\LOCALSERVICE” and
    “NT AUTHORITY\NETWORKSERVICE” are also available as well
    as the well known SIDs for all three.
    /RP password Specifies a new password for the existing user
    context or the password for a new user account.
    This password is ignored for the system account.
  • /TR taskrun Specifies the new program that the
    scheduled task will run.
  • /ST starttime Specifies the start time to run the task. The time
    format is HH:mm (24 hour time) for example, 14:30
    for 2:30 PM.
  • /RI interval Specifies the repetition interval in
    minutes. Valid range: 1 – 599940 minutes.
  • /ET endtime Specifies the end time to run the task. The time
    format is HH:mm (24 hour time) for example, 14:50
    for 2:50 PM.
  • /DU duration Specifies the duration to run the task. The time
    format is HH:mm. This is not applicable with /ET.
  • /K Terminates the task at the endtime or duration time.
  • /SD startdate Specifies the first date on which the task runs.
    The format is mm/dd/yyyy.
  • /ED enddate Specifies the last date when the task should run.
    The format is mm/dd/yyyy.
  • /IT Enables the task to run interactively only if the
    /RU user is currently logged on at the time the job
    runs. This task runs only if the user is logged in.
  • /RL level Sets the Run Level for the job. Valid values are
    LIMITED and HIGHEST. The default is to not change it.
  • /ENABLE Enables the scheduled task.
  • /DISABLE Disables the scheduled task.
  • /Z Marks the task for deletion after its final run.
  • /DELAY delaytime Specifies the wait time to delay the running of the
    task after the trigger is fired. The time format is
    mmmm:ss. This option is only valid for schedule types
    ONSTART, ONLOGON, ONEVENT.

Create A Scheduled Tasks/Job With More Options

In previous example we have used to very little options. We can provide more needed attributes. In this example we will provide

  • /RU for the username
  • /RP for password
  • /SC for period
  • /D ‘ for date
  • /TN for task name
  • /TR for executable file or command
  • /ST for time

Create A Scheduled Tasks/Job With More Options

List All Ready Created Scheduled Tasks/Jobs

In a IT environment there will be a lot of existing scheduled jobs. We can list these existing tasks just issuing schtasks like below.

For each task following information is printed.

  • Folder shows namespace based location.
  • Taskname shows given name for the task to identify
  • Next Run Time shows when will the task will run for the next time
  • Status shows whether the task is ready to run or running or there is a problem.

Delete Scheduled Task/Job

All ready scheduled jobs can be deleted if we do not need it. We can delete task with /delete option and specifying the task name. In this example we will delete task named degfrag which is specified with /TN option.

Delete Scheduled Task/Job

While deleting we need to confirm the delete operation. If the task is deleted properly we will get a SUCCESS message.

Delete All Scheduled Task/Jobs

If we do not need all of the scheduled jobs and we want to delete them in a single shot we can use asterisks * sign to specify task name.

Disable Scheduled Task/Job

Some time we may need to disable scheduledjob for a short period. We can use /change option with /disable option in order to disable a scheduled job. In this example we will disable the job named defrag .

Disable Scheduled Task/Job

Enable Scheduled Task/Job

We can enable scheduled job similar to disable operation where we use /enable .

Enable Scheduled Task/Job

Modify Scheduled Task/Job

A scheduled task can be changed with /change option. We can specify the attribute we want to change. In this example we will change the username and password of the user which will run task with /RU and /RP .

Modify Scheduled Task/Job

Источник

Как запустить Планировщик заданий Windows — 7 способов

Давайте посмотрим, как запустить Планировщик заданий Windows на компьютере разными способами. Оснастка Планировщик заданий — компонент операционной системы Windows для выполнения различных заданий, запланированных в определенное время.

С помощью Планировщика заданий выполняются работы по автоматическому обслуживанию операционной системы, выполняется отложенный запуск приложений и т. п. Часть заданий запланирована в Планировщике самой Windows, другие задания автоматически добавляются программами или планируются пользователем, после добавления задания вручную в средство системы.

Планировщик заданий позволяет запланировать и автоматически выполнить конкретные действия на компьютере в определенное время, без участия пользователя. Среди выполняемых операций могут быть совсем нежелательные задания.

Как открыть Планировщик заданий Windows? Есть несколько способов для запуска оснастки в операционной системе. В статье мы разберем варианты, которые подходят для Windows 10, Windows 8.1, Windows 8, Windows 7.

Как открыть Планировщик заданий в окне «Выполнить»

Универсальный способ для запуска Планировщика заданий во всех версиях операционной системы Windows: запуск команды с помощью диалогового окна «Выполнить».

Проделайте следующие действия:

  1. Нажмите одновременно на клавиши клавиатуры «Win» + «R».
  2. В окне «Выполнить», в поле «Открыть:» введите команду: «taskschd.msc» (без кавычек), а затем нажмите на кнопку «ОК».

На Рабочем столе компьютера откроется оснастка Планировщик заданий. Теперь вы можете посмотреть запланированные задания, при необходимости, изменить или удалить ненужные задания.

Как открыть Планировщик заданий при помощи поиска Windows

Следующий способ: использование штатной функции поиска в операционной системе Windows. Выполняемое действие подобно во всех версиях системы, отличается только интерфейс Виндовс.

В Windows 7 войдите в меню «Пуск», введите выражение «планировщик заданий» (без кавычек) в поле «Найти программы и файлы», запустите приложение.

В Windows 8.1 и Windows 8 проведите курсором мыши сверху вниз в правой части экрана, в боковой панели, в поле «Поиск» введите выражение «планировщик заданий» (без кавычек), запустите системное средство.

В Windows 10 кликните по значку поиска на Панели задач, введите выражение «планировщик заданий» (без кавычек), запустите классическое приложение.

Запуск Планировщика заданий в командной строке

Далее рассмотрим еще один инструмент для того, чтоб открыть Планировщик заданий — командная строка. О том, как найти командную строку в Windows 10 читайте здесь.

  1. Запустите командную строку от имени администратора.
  2. В окне интерпретатора командной строки введите команду: «taskschd.msc» (без кавычек), а затем нажмите на клавишу «Enter».

После этого, на компьютере откроется окно «Планировщик заданий».

Как открыть Планировщик заданий в Windows PowerShell

Еще один из способов для запуска планировщика на компьютере: с помощью средства Windows PowerShell.

В Windows 10 сделайте следующее:

  1. Щелкните правой кнопкой мыши по меню «Пуск», выберите «Windows PowerShell (администратор)».
  2. В окне «Администратор: Windows PowerShell» введите команду: «taskschd.msc» (без кавычек), а после этого нажмите на клавишу клавиатуры «Enter».

В результате, на ПК будет открыт Планировщик заданий.

Открытие Планировщика заданий в Управление компьютером

Планировщик заданий встроен в консоль Управление компьютером, оттуда его можно открыть.

Для запуска консоли Управление компьютером можно воспользоваться диалоговым окном «Выполнить», введя команду: «compmgmt.msc» (без кавычек).

Другой способ войти в консоль Управление компьютером:

  1. Кликните по значку «Мой компьютер» («Этот компьютер») на Рабочем столе. Прочитайте тут, как вернуть значок «Мой компьютер» на Рабочий стол.
  2. В контекстном меню выберите пункт «Управление».

В окне «Управление компьютером» в разделе «Управление компьютером (локальный)» в списке служебных программ отобразится Планировщик заданий.

Открываем Планировщик заданий из меню «Пуск»

Планировщик заданий присутствует в списке приложений меню «Пуск». Для запуска приложения необходимо войти в меню «Пуск», среди списка программ найти папку «Средства администрирования», а затем запустить Планировщик заданий.

Как открыть планировщик заданий Windows из Панели управления

В завершении, мы запустим системное средство из Панели управления. Сначала необходимо открыть Панель управления операционной системы.

Мы запустим Панель Управления способом, который работает во всех версиях Windows:

  1. Нажмите на клавиши «Win» + «R».
  2. В диалоговом окне «Выполнить» введите команду «control» (без кавычек), а затем нажмите на кнопку «ОК».
  3. После запуска Панели управления, в настройках просмотра необходимо выбрать «Мелкие значки».
  4. В окне «Все элементы панели управление» нажмите на «Администрирование».
  5. В окне «Администрирование» выберите «Планировщик заданий».

Выводы статьи

В случае необходимости, пользователь может открыть Планировщик заданий в Windows разными способами: вводом команды из диалогового окна «Выполнить», из командной строки, из Windows PowerShell, осуществить запуск приложения из меню «Пуск», из оснастки Управление компьютером, из Панели управления, с помощью поиска.

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

  • Windows samba server windows 7
  • Windows safe mode windows update
  • Windows run bat as administrator
  • Windows ruby on rails установка windows
  • Windows rt запуск десктопных приложений