≡ Menu

Windows at command examples

At command, as the name indicates, can be used to schedule applications at specified time and date. This is a built-in command in Windows OS and does not require any separate software to be installed on the computer.

First thing you need to know is that At command requires Task Scheduler service to be running on the system. Otherwise you would get an error like below.

C:\>at
The service has not been started.

Let’s see few examples on how to use At command.

Schedule a task at a particular time

To schedule a task we just need to specify the time and the command for the task we need to run. For example, if you want to shutdown your computer at 11PM today then you can do this by running the below command.

At 11:00:00PM shutdown -r

Schedule a Recurrent Task

We can schedule tasks that run recurrently once in a week or once in a month. We can use /every switch for this purpose. Let’s say you want to automatically run defragmentation on one of the drives once in every week. This can be done by running the below command

At 10:00:00AM /every:Monday defrag c:

After running this command system will initiate defragmentation on C: drive at 10 AM on every Monday.

See the tasks scheduled

We can see the list of scheduled tasks just by running At command without any parameters.

C:\>at
Status ID Day Time Command Line
-------------------------------------------------------------------------------
1 Each M 10:00 AM defrag c:

C:\>

Schedule a task on some other day

We can use /next switch to schedule tasks for a different day. For example to run defragmentation on C: drive on next Thursday you can run the below command.

At 11:00:00AM /next:Thursday defrag c:

Schedule tasks to run every day

Using /every switch we can schedule a task to be run every day. For example to shutdown your computer automatically every day at 11PM you can create a task using the below command.

At 10:00:00AM /every:M,T,W,TH,F,SA,SU shutdown -r

Delete Scheduled Tasks

We can delete scheduled tasks from the database by using /delete switch. We need to pass the id of the task we need to delete. We can see the id for each task by running At command without any parameters. For example to delete the task with the id 1 we need to run the below command.

At 1 /delete
19 comments… add one
  • ETL

    I’m not sure if it’s related to the topic but I’ll ask anyway.
    I need to get the exact location of a process name that a scheduled job is executing. I want to use WMIC JOB (if you have any other suggestions.. let me know) to get that, but I don’t know HOW exactly. I’ve tried several variations but no luck so far.
    How should I do that?
    I thought of direction like-
    wmic job where name=”at2″ get command /value
    but no luck.
    Thanks in advance.

    If it’s not the place to ask, tell me where can I ask.

    BTW thanks for the article :)

    • admin

      I have tried this wmic command. It seems to be showing the jobs that are scheduled using at command. For the ones scheduled using the GUI task scheduler, it’s not showing any data and displays the message ‘No instance(s) available’.

      You can try this command to get the command information.

      wmic job where jobid=id get command

      I have observed that name field is empty for the jobs scheduled using ‘at’. So you better use the job id. Or running ‘wmic job get command’ will show the commands for all the jobs currently running.

  • ETL

    Why jobid=2? How can you be sure?
    I want to know the command of a specific job that is not nessecerily running RIGHT NOW. I need it to check for every job exists.

    wmic job get command shows “No Instance(s) Available”.
    Same at “wmic job where jobid=2 get command”.

    Thanks.
    BTW Is that a new site running?

    • admin

      I have used 2 just as an example, you need to use the id of your job.
      if you want to get it for every job, as I mentioned earlier, run the below command.
      wmic job get command

      Note that you need to run this from elevated administrator command prompt. otherwise you may get ‘no instance(s) available’ message.

  • ETL

    How can I know the jobid? Problem is that I can’t know it (or am I wrong?).
    The only thing I can know is the job’s name (‘at2’ for example). The WMIC JOB command need to be based on that.

    I’ve tried as administrator (although UAC is disabled), same =\

    • admin

      wmic job shows the jobs that are running at that time.
      you can get the job list using at command.

  • ETL

    Oh.. so you mean I can forget about WMIC for what I need?

    I’ve tried typing only ‘at’ command, all I got is “There are no entries in the list”, while I do have one (named at3). Even if I’ll manage to see the list, is there a way to get somehow only the command itself? (the process name)

    Thanks.

  • ETL

    I’d be glad for some answers :)
    Thanks.

    • admin

      My previous replies have the answers.
      First use at command to get the job id. If at command doesn’t show it, get it from scheduled tasks UI
      Then use the below command.
      wmic job where jobid=id get command
      As mentioned earlier, this command will work only if the scheduled job is running at that time.

  • ETL

    Ha! I got it finally.
    Somewhy I haven’t pay attention to what you said earlier “It (WMIC command) seems to be showing the jobs that are scheduled using at command”.
    Now I can be 100% sure I won’t need it unfortunately.

    Thank you! :)
    I guess I won’t bother you again with dumb questions… :P

  • imeb

    how would you make it run on log in
    kinda’ like:
    at login /every:M,T,W,TH,F,SA,SU start iexplore.exe (or any .exe/.bat)

  • Fred

    I used the AT command on my Windows 7 OS but it is giving me “access denied” error message.

    • admin

      Run it from elevated administrator command prompt.

    • Elnaggar

      disable UAC and should work

  • Chris Dodds

    Is it possible when running the “AT” command, to add a job name? As in – whenever the scheduled task is created, it creates the task with a job name of “At1” or “At2”, etc. Is there a way to specify what the scheduled task might be called?
    – Chris

    • admin

      This is very late, but for the benefit of others having the same question, ‘At’ command does not provide a way to tag the command with a specific id. When we schedule a new task, it automatically tags them with ids like’at1′, ‘at2’, ‘at3’ and so.

  • Jonney

    Unfortunately this command seems to be deprecated in W10, replaced with some ugly schtasks or something, too bad I really liked the syntax of this one,

  • Raghavendra

    How to delete AT1 ,at1 ,at3,at4 .. etc… with command line and leave other windows task running

  • Raghavendra

    I tried with schtasks /delete /tn * /F then my all windows task got deleted , I want only AT tasks needs to deleted

Leave a Comment