Scheduling Tasks On Windows With Schtasks

Today I like talk about Schtasks command on Windows, it is a classical tool use since many time.

Creating a new task

C:\oracle\oradb\admin>schtasks /create /tn “Xwin purge” /tr “C:\oracle\oradb\bin\sqlplus xxx/yyy @C:\oracle\oradb\admin\purge.sql” /sc daily /st 14:10 /ed 04/02/2017
The task will be created under current logged-on user name (“MEDIATV\dbadmin”).
Please enter the run as password for MEDIATV\dbadmin: *******

WARNING: The scheduled task “Xwin purge” has been created, but may not run b
ecause the account information could not be set.


Displaying scheduled tasks

C:\oracle\oradb\admin>schtasks /query
INFO: There are no scheduled tasks present in the system.

Deleting a scheduled task

C:\oracle\oradb\admin>schtasks /delete /TN “Xwin purge”
WARNING: Are you sure you want to remove the task “Xwin purge” (Y/N )? y
SUCCESS: The scheduled task “Xwin purge” was successfully deleted.

Running now the task

C:\oracle\oradb\admin>schtasks /run -tn “Xwin purge”
SUCCESS: Attempted to run the scheduled task “Xwin purge”.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s