From the computer of: qmchenry
(339 recipes)
Created: May 02, 2004
The minimum parameters required to run a task once are /sc (schedule), /tr (task to run), /st (start time), and /tn (unique task name). This syntax will run the task as the current user. To run the defrag program on the C: drive at 11 PM, use this command:
The schedule (/sc once) indicates that the task will only be executed once. The start time (/st 23:00:00) determines the time (HH:MM:SS) that the task will start in the 24 hour format. The task name (/th cdefrag) must be a unique name that can be used to reference the scheduled task later. The task to run (/tr "defrag c:") specifies the command and parameters to run. Enclosing the task to run in quotes is required for tasks with options.
When you run the command above, it will tell you the user the task will run under (the current user) and will prompt for that user's password. It is possible to place the password in the command (using /rp password) although to do so may be a security risk -- use at your own risk.
If you want to run the task as another user, specify the username with the /ru username command option.
By default, the task will execute within the next 24 hours at the next occurance of the start time. To run the command at the speficied time on a different date, use the /sd mm/dd/yyyy option.
To view the scheduled events, just run schtasks with no options.
Subscribe to the Tech-Recipes Newsletter
You can get tips like this delivered in your email every week!
We will never, ever sell your email address or spam you.
Related recipes:
RunAs a User on the Network
Vista: Associate a File Type with a Specific Program
95/98/ME/XP: Adjust Amount of CPU Resources a DOS Program Receives
XP/2000: configure client sntp time protocol settings
Outlook 2003: How To Give Your Email Message an Expiration Date
Vista: Defrag (Defragment) Drive
XP: Prevent Program from Appearing in the Frequently Used Program List
Windows: How to Quit or Exit a Frozen, Locked-Up, Nonresponding Program
Getting an Older Program to Run on Windows XP
XP Pro and Vista: List active Windows programs from command line with tasklist
Sponsored links
Login
Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.Search
Tech Recipes
· Home
· Mac OS X
· Solaris
· Windows
· Programming
· UNIX
· Cisco
· MySQL
· Google
· Instant messaging
· Add recipes
· Leave feedback
· Recommend us
· RSS Syndication
Hot recipes
Make XP look like Windows Vista / Longhorn for free!
XP: Small, Free Way to Use and Mount Images (ISO files) Without Burning Them
Hacks to Beat Rapidshare Download Limits and Waiting Time
Vista: Should I Install 64-bit or 32-bit Version? (x64 vs x86)
How Do I Use or Open Bin, Cue, or ISO Files?
MySpace Hack: View Pictures and Comments on a Private Profile
SMS through E-Mail: Cingular, Nextel, Sprint, T-Mobile, Verizon, Virgin Mobile
MySpace: Hack to Dowload Any Song on Myspace
Who's Online
There are currently, 1813 guest(s) and 1 member(s) that are online.
You are Anonymous user. You can register for free by clicking here
Information
Wish to advertise with us?
All logos and trademarks in this site are property of their respective owner. The comments and forum posts are property of their posters, all the rest © 2003-2007 by QD Ideas, LLC.
Users of this site are legally bound by the Terms and conditions and Disclaimer. Do not use this web site if you do not agree with these policies.
The members, admins, and authors of this website respect your privacy.
Page Generation: 0.74 Seconds
Mon Sep 8 0:48:00 2008