Windows 10: Make Scheduled Task

2020-May-23

💨 by Eugene Ruthven

email Feedback About This Page

Preparation:

  1. Batch file to be run 4 times a day:
    ideasBkup.bat
    @echo off

    robocopy C:\Users\eugene\Documents\ideas h:\Bkup202005\ideas /e > nul

    set mydate=%date%
    set mydate=%mydate:-=%

    set mytime=%time%
    set mytime=%mytime: =0%
    set mytime=%mytime::=%
    set mytime=%mytime:~0,4%

    set myway=%mydate%-%mytime%

    set "oldname=h:\Bkup202005\ideas"
    set "newname=ideas%myway%"

    rem echo %newname%
    ren "%oldname%" "%newname%"

    It copies a folder with its subfolders and files to a thumb drive.
  2. Need an account with administrative privileges and its password.

To Create a Scheduled Task

  1. Start Task Scheduler
    1. Click Start.
    2. Under W, find and click:Windows Administrative Tools
    3. Find and right-click on: Task Scheduler
    4. A mini-menu shows.
    5. Click More.
    6. Another mini-menu appears.
    7. Click Run as administrator.
    8. A window will open asking for an administrative account and its password.
    9. Type administrative account and its password.
    10. Click OK.
  2. The Task Scheduler window opens. The title: Task Scheduler is in the upper left corner.
  3. When the Task Scheduler Library is clicked, a list of scheduled tasks appears in the center section.

    In the lower information area the Properties window appears in read-only mode.

    If you want to change anything, open Properties in change mode by clicking Properties at the side.

  4. Find and click on Create Task... at the right side under the Actions section.
  5. Create Task window opens.
  6. The General tab has the focus.
  7. To the right of the Name label type the name for your task. Here I type:
    CopyFilesToThumbDrive
  8. Under Security options section:

    Uncheck Run only when user is logged on checked by default

    Check Run whether user is logged on or not

    Check Do not store password. The task will only have access to local computer resources.

  9. Click Triggers tab.

    There will be 4 triggers.

    This is being created 2020-May-21, afternoon - 3pm - so for 4 triggers 6 hours apart I'll use:
    6 pm, 2020-May-21
    12 midnite, 2020-May-22
    6 am, 2020-May-22
    12 noon, 2020-May-22

    Trigger 1 - 6pm, 2020-May-21

    1. Click New - lower left corner.
    2. Another window called New Trigger opens.
    3. Beside the label: Begin the task: On a schedule is already selected - leave it.
    4. Under Settings section, you have the choices:
      One time (already selected)
      Daily
      Weekly
      Monthly
      check Daily
    5. Recur every 1 days appears - leave as is.
    6. Start aleady has a default date & time:
      Set date to 2020-05-21
      Set time to 6:02:00 PM
    7. Look under Advanced settings
    8. If check Repeat task every the choices shown are:
      5 minutes
      10 minutes
      15 minutes
      30 minutes
      1 hour
      none of these work for me - I want 4 times a day - 6 hours apart - that's the reason to create 4 triggers

      This won't be used.

    9. Check Stop task if it runs longer than: 30 minutes
    10. Check Enabled.
    11. Click OK - lower right corner.
    12. New Trigger window closes.
    13. The new trigger appears on the Triggers tab
    14. End of setting up Trigger 1.

     

    Trigger 2 - 12:02am, 2020-May-22

    1. Click New - lower left corner.
    2. New Trigger window is opened again.
    3. For Begin the task: On a schedule is already selected - leave as is.
    4. Under Settings section, change
      One time (already selected)
      to:
      Daily by checking it
    5. When Daily selected, Recur every 1 days appears
    6. Start aleady has a default date and time:
      Set date to 2020-05-22
      Set time to 12:02:00 PM
    7. Under Advanced settings
    8. Check Stop task if it runs longer than: 30 minutes
    9. Check Enabled
    10. Click OK - lower right corner
    11. New Trigger window closes.
    12. The new trigger appears on the Triggers tab
    13. End of setting up Trigger 2.

     

    Trigger 3 - 6:02am, 2020-May-22

    1. Click New - lower left corner.
    2. New Trigger window is opened again.(got not responding for about 1-2 minutes)
    3. For Begin the task: On a schedule is already selected - leave as is.
    4. Under Settings section, change
      One time (already selected)
      to:
      Daily by checking it
    5. When Daily selected, Recur every 1 days appears
    6. Start aleady has a default date and time:
      Set date to 2020-05-22
      Set time to 6:02:00 AM
    7. Under Advanced settings
    8. Check Stop task if it runs longer than: 30 minutes
    9. Check Enabled
    10. Click OK - lower right corner
    11. New Trigger window closes.
    12. The new trigger appears on the Triggers tab
    13. End of setting up Trigger 3.

     

    Trigger 4 - 12:02pm, 2020-May-22

    1. Click New - lower left corner
    2. Opens New Trigger window again (got not responding for about 1-2 minutes)
    3. Begin the task: On a schedule selected ok
    4. under Settings section
      Change:
      One time (already selected)
      to
      Daily
    5. Start aleady has a default date & time
      set date to 2020-05-22
      set time to 12:02:00 PM
    6. When Daily selected, Recur every 1 days appears this is OK
    7. Under Advanced settings:
      Check Enabled
    8. Click OK - lower right corner
    9. Done setting up 4th and last trigger
  10. Click Actions tab
  11. Click New - lower left corner
  12. New Action window opens
  13. Action: Start a progrm default - leave as is
  14. Under Settings section:
    under Program/script see long white rectangle
    to its right is Browse...
  15. Click Browse...
  16. Open window opens (title is in upper left corner)
  17. Browse to the .bat file
  18. Once the .bat has been found, click on it and then click Open - lower right corner
  19. Open window closes
  20. Back to New Action window
  21. Leave Add arguments (optional) blank
  22. Leave Start in (optional) blank
  23. Click OK - lower right corner
  24. Click Condtions tab
  25. Under Power section
    Check Start the task only if the computer is on AC power
    Uncheck Stop if the computer switches to battery power
  26. Leave everything else unchecked.
  27. Click Settings tab.
  28. Check Allow task to be run on demand
  29. Check Stop the task if it runs longer than and pick 30 minutes
  30. Check If the running task does not end when requested, force it to stop
  31. Click OK - lower right corner
  32. Click OK
  33. The Properties window closes.
  34. Finished setting up Task.

After Task Has Been Created

Check your settings.

I found 2 problems:

  1. the 1st trigger at 6pm copied the wrong folder
  2. the 3rd trigger at 6am did not run

1. the 1st trigger at 6pm copied the wrong folder
Problem: I had picked the wrong .bat file - similar file names<

  1. Open Properties window for my Task
  2. Click Actions tab
  3. Click on the Action with the problem .bat
  4. Click Edit
  5. Edit Action window opens
  6. Click Browse...
  7. Open window opens
  8. Browsed to the correct .bat file
  9. Click Open.
  10. Open window closes
  11. Click OK
  12. Edit Action window closes
  13. Click OK
  14. Properties window closes

2. the 3rd trigger at 6am did not run
Problem: PM instead of AM for 2 of the triggers

  1. Open Properties window for my Task
  2. Click on Trigger tab to fix
  3. Click Edit
  4. Edit Trigger window opens
  5. Change PM to AM
  6. Click OK
  7. Edit Trigger window closes
  8. Check that the change appears.
  9. Fix the other Trigger
  10. Click OK
  11. Properties window closes

To Review Task Settings

  1. Start Task Scheduler
  2. If you don't see the list of Tasks shown in the center area, click Task Scheduler Library.
  3. Find your task name in the list and click it.
  4. The General tab is shown by default - check the settings there.
  5. Click Triggers tab - check:
    Trigger
    Details
    Status: Enabled/Disabled
  6. Click Actions tab - check:
    Action
    Details
  7. Click Conditions tab - check the various options:
    1. i found: Stop if the computer ceases to be idle was checked - not what i wanted
    2. to fix: click Properties at the right side to open the Properties window for your task
    3. click Conditions tab
    4. when looking at it this way it is easier to see that Start the task only if the computer is idle affects Stop if the computer ceases to be idle
    5. since Start the task only if the computer is idle is not checked then Stop if the computer ceases to be idle is not active
    6. ok things are fine
  8. Click Settings tab - check:
    Allow task to be run on demand
    Stop the task if it runs longer than 1 hour (selected)
    If the running task does not end when requested force it to stop

🏆 🎈 The End!!! 🏁 📣