Post

Task Scheduler Windows

Task Scheduler for Windows

This is a guide on using the task scheduler on Windows.

  1. Use schtasks for help.
    1
    
    schtasks -? 
    
  2. List out scheduled tasks. Use -tn to find a specific task.
    1
    
    schtasks -query -fo list -v -tn "test_automate_extract"
    

Creating Tasks

  1. Create a task. Notes: tn = task name, tr = task location, sc = how often, st = start time.
    1
    
    schtasks -create -tn "test_automate_extract" -tr /c/Users/Hello/Documents/WorkPro~1/11Auto~1/hello_world.sh -sc daily -st 03:47:00
    
  2. Note: if directories have spaces use the shorthand of the file name. For example “Work Projects” would be “WorkPro~1”. The following command will give you a list of all the shorthand file names in the “Documents” directory:
    1
    
    dir /X ~1 C:\Users\Hello\Desktop\
    
  3. Change the task with:
    1
    
    schtasks -change -tn "test_automate_extract" -st 22:11
    
  4. Delete the task. Use f to bypass the warning.
    1
    
    schtasks -delete -tn "test_automate_extract" -f
    
This post is licensed under CC BY 4.0 by the author.