ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

Windows scheduler using Command Prompt

Updated on October 20, 2012

Introduction

With our very busy schedule, we sometimes want some things to be automated. That is the idea of programming: to automate. Programs are made to make our lives easier. They do a series of tasks that are necessary for a single job to be done.

Windows offers a very powerful utility. That is command prompt. It looks intimidating but it is really easy to use. It has a lot of commands that will let you do tasks the “old-school-way” or do some others that is only possible in CMD. To be know all the commands in the command prompt, type “help” in the console then it will list most commands. There are also other commands that are not listed like “telnet.”

In this article we will be talking about how to schedule programs using this program. The command we will be using is the “at” command. It uses the Windows Scheduler service to set a program to execute on a given schedule.

example: the at command executing cmd.exe at 10:42pm.
example: the at command executing cmd.exe at 10:42pm.

The "at" Command

In Windows 7 and Vista, you need to run the command prompt as administrator to be able to use the “at” command. To do this, type “cmd” in the search dialog then right click cmd.exe then choose run as administrator. If a dialog box appears, click yes. This gives Command Prompt special access privileges on your computer. If Command Prompt is not ran as an administrator, you will not be able to do anything with the “at” command. An “Access denied” message will always appear.

The syntax of the “at” command as command prompt says is this:

“AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]]

AT [\\computername] time [/INTERACTIVE]

[ /EVERY:date[,...] | /NEXT:date[,...]] "command"

\\computername Specifies a remote computer. Commands are scheduled on the local computer if this parameter is omitted.

id Is an identification number assigned to a scheduled command.

/delete Cancels a scheduled command. If id is omitted, all the scheduled commands on the computer are canceled.

/yes Used with cancel all jobs command when no further confirmation is desired.

time Specifies the time when command is to run.

/interactive Allows the job to interact with the desktop of the user who is logged on at the time thejob runs.

/every:date[,...] Runs the command on each specified day(s) of the week or

month. If date is omitted, the current day of the month is assumed.

/next:date[,...] Runs the specified command on the next occurrence of the day (for example, next Thursday). If date is omitted, the current day of the month is assumed.

'command' Is the Windows NT command, or batch program to be run.”

You can make the above text show up in command prompt by typing “at /?”

A command may be a program (*.exe) or a batch script (*.bat). Time is in military time, i.e. 1pm is 13:00. In Windows 7, the “/interactive” switch will not work meaning you will not be able to interact with the executed program. If you try to do that, Command Prompt will inform you to use “schtasks” instead.

An example of the use of the “at” command is the picture above. If you wish to execute a program outside of “Windows/System32.” You will need to indicate the complete path to the program. Example:

At 14:22 “c:\program files\batch files\filename.bat”

This creates a schedule for a filename.bat script to run at 2:22 pm. It will only run once. If you want to run it multiple times, add the /every:date script.

"schtasks"
"schtasks"

Alternative

Another command is, as mentioned earlier, “schtasks.” You can find out the syntax of the command by typing “schtasks /?” It works much like the “at” command however the syntax is different and you get to have more control.


Comments

    0 of 8192 characters used
    Post Comment

    • leakeem profile imageAUTHOR

      leakeem 

      6 years ago from Earth

      Thanks chefmancave! I'll check that out.

    • chefmancave profile image

      Robert Loescher 

      6 years ago from Michigan

      Leakeem...Good description of the AT command. Check out the hubpage on Windows Scripting Host and Autoit. If you are a Command Line geek like me, you will absolutely love AutoIt.

    working

    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, hubpages.com uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: https://hubpages.com/privacy-policy#gdpr

    Show Details
    Necessary
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the googleapis.com or gstatic.com domains, for performance and efficiency reasons. (Privacy Policy)
    Features
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Marketing
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Statistics
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)