SCHTASKS


In Windows 7 and later you can use the SCHTASKS command in command prompt to run batch files and perform other tasks at specified times. In order for this to be successful in running batch files you will need to be logged into your system as an admin.

If you're not logged in as an admin, and you try to run many commands you're likely to get an 'Access is denied' message. Going to All Programs . . . Accessories and right clicking on Command Prompt and selecting 'Run as Administrator' will get around this problem and allow you to use SCHTASKS to run executables or perform other tasks. However SCHTASKS will not successfully run batch files to do things such as copy files from one folder to another, unless you're logged in as an administrator. When you're logged in as an admin you can enter a SCHTASKS command this way:

SCHTASKS /Create /SC ONCE /ST 21:24 /TN litsupp99 /TR "c:\foofolder2\copy.bat"

/SC lets you set how often you want this command to run. Instead of 'ONCE' you can also put 'HOURLY', 'DAILY', 'WEEKLY', or 'MONTHLY'. /ST lets you set the specific time [it must be in military time] you want the command to run. If you want the command to run on a specific date you could also enter /SD , and then enter a date in this format, "07/04/2017". /TN sets a specific task name (don't omit this), and finally /TR to specify the task to run. When listing the file path for the batch file be sure to put it in quotes.

Note that this command won't work if you need to write a file to a folder such as in running a dir command to print out the contents of a directory .

SCHTASKS has made the old AT command obsolete, so use it instead of trying to make AT work.