Is it possible to use the AT command to run a command every 5 minutes?

4

1

The Windows AT command has an "every" parameter, which can take days of the week, and a "time" parameter specifying the time of day, however I'd like to run a command every 5 minutes. Any way to do this? I've looked at some similar questions, but nothing gives an actual example of the command line syntax for this.

I'm running Windows 7. Thanks!

Mike Christensen

Posted 2012-11-15T17:04:44.120

Reputation: 3 299

Answers

4

Answer to your question is no, but on the other hand you can use even better utility called schtasks.

This should be up every 5min

schtasks /create /tn "CLICKCLACK" /tr tiktak.bat /sc minute /mo 5

week

Posted 2012-11-15T17:04:44.120

Reputation: 3 128

One more note - while the 'schtasks' command can't be used on a remote computer, you can schedule the schtasks command to be executed on a remote computer using the at command. – lordcheeto – 2015-06-02T02:08:56.197

Awesome! Much better than the old AT command. – Mike Christensen – 2012-11-15T17:27:50.427

Oh one issue with this is it pops up a command prompt on the screen every 5 minutes, which is kinda annoying. Any way to get it to run the command silently? It's just a console program (EXE) I'm running. – Mike Christensen – 2012-11-15T17:31:18.700

Run with /RU as another user should help OR here is another solution http://superuser.com/questions/195249/how-to-execute-a-scheduled-task-with-schtasks-without-opening-a-new-command-li

– week – 2012-11-15T17:37:51.193

The VBS wrapper works.. Good enough for now! Thanks.. – Mike Christensen – 2012-11-15T17:41:34.073

1

You can create a Scheduled Task that is configured a job every five minutes. For example, I used the Task Scheduler tool to create a simple job that repeats every five minutes. If you want to use an interval that isn't available on the drop-down list, you can use the schtasks command, with which you can specify an interval in whole minutes.

Detailed information about the Task Scheduler: http://technet.microsoft.com/en-us/library/cc721871.aspx

Detailed information about the schtasks command: http://technet.microsoft.com/en-us/library/cc725744.aspx

Here, I'm displaying the properties of the task with the schtasks command:

C:\>schtasks /query /v /tn Test /fo list

Folder: \
HostName:                             MyComputer
TaskName:                             \Test
Next Run Time:                        11/15/2012 12:30:07 PM
Status:                               Ready
Logon Mode:                           Interactive/Background
Last Run Time:                        N/A
Last Result:                          1
Author:                               DOMAIN\user
Task To Run:                          xcopy c:\temp\file1.txt c:\temp\files2.txt /Y
Start In:                             N/A
Comment:                              N/A
Scheduled Task State:                 Enabled
Idle Time:                            Disabled
Power Management:                     Stop On Battery Mode, No Start On Batteries
Run As User:                          SYSTEM
Delete Task If Not Rescheduled:       Enabled
Stop Task If Runs X Hours and X Mins: 24:00:00
Schedule:                             Scheduling data is not available in this format.
Schedule Type:                        Daily
Start Time:                           N/A
Start Date:                           N/A
End Date:                             N/A
Days:                                 Every 1 day(s)
Months:                               N/A
Repeat: Every:                        0 Hour(s), 5 Minute(s)
Repeat: Until: Time:                  None
Repeat: Until: Duration:              24 Hour(s), 0 Minute(s)
Repeat: Stop If Still Running:        Disabled

Geoff Duke

Posted 2012-11-15T17:04:44.120

Reputation: 477