Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

How to Create and Manage Scheduled Tasks in Windows

Scheduled tasks are an essential feature in Windows that allow users to automate repetitive tasks, run scripts, and perform maintenance activities at specified times or intervals. This article will guide you through the process of creating, managing, and executing scheduled tasks using both the graphical user interface (GUI) and command-line tools like Command Prompt (CMD) and PowerShell.

Examples:

Example 1: Creating a Scheduled Task Using Task Scheduler GUI

  1. Open Task Scheduler:

    • Press Win + R, type taskschd.msc, and press Enter.
  2. Create a Basic Task:

    • In the Task Scheduler window, click on "Create Basic Task" in the Actions pane.
    • Enter a name and description for the task, then click "Next".
  3. Set the Trigger:

    • Choose when you want the task to start (e.g., Daily, Weekly, etc.), then click "Next".
    • Set the specific start time and recurrence details, then click "Next".
  4. Set the Action:

    • Choose "Start a program" and click "Next".
    • Browse to the program or script you want to run, and add any arguments if necessary, then click "Next".
  5. Finish:

    • Review the summary of the task and click "Finish" to create the task.

Example 2: Creating a Scheduled Task Using CMD

  1. Open Command Prompt:

    • Press Win + R, type cmd, and press Enter.
  2. Create the Task:

    • Use the schtasks command to create a scheduled task. For example, to run a script daily at 10 AM:
      schtasks /create /tn "DailyScript" /tr "C:\Scripts\MyScript.bat" /sc daily /st 10:00

Example 3: Creating a Scheduled Task Using PowerShell

  1. Open PowerShell:

    • Press Win + R, type powershell, and press Enter.
  2. Create the Task:

    • Use the New-ScheduledTaskTrigger, New-ScheduledTaskAction, and Register-ScheduledTask cmdlets. For example:
      $trigger = New-ScheduledTaskTrigger -Daily -At 10:00AM
      $action = New-ScheduledTaskAction -Execute "C:\Scripts\MyScript.bat"
      Register-ScheduledTask -TaskName "DailyScript" -Trigger $trigger -Action $action -User "SYSTEM"

Example 4: Listing Scheduled Tasks Using CMD

  1. Open Command Prompt:

    • Press Win + R, type cmd, and press Enter.
  2. List the Tasks:

    • Use the schtasks command to list all scheduled tasks:
      schtasks /query /fo LIST /v

Example 5: Deleting a Scheduled Task Using CMD

  1. Open Command Prompt:

    • Press Win + R, type cmd, and press Enter.
  2. Delete the Task:

    • Use the schtasks command to delete a scheduled task:
      schtasks /delete /tn "DailyScript" /f

Conclusion

Scheduled tasks in Windows provide a powerful way to automate tasks and ensure that important scripts and programs run at the right times. Whether you prefer using the GUI, Command Prompt, or PowerShell, Windows offers multiple methods to create, manage, and delete scheduled tasks.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.