AT Command - Every 5 Minutes

Is there a way to setup a command to be executed with the NT AT command to be executed every five minutes?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

use the command soon.exe from the ntreskit, and let it start a batchfile that executes your program or command and end it again with another soon.exe.

Thist command is very simple to use, it is just soon.exe <secs> command.
It actually uses AT to do the job.
the at command does not support an /every for hours and minutes, so you need to set up a whole series of at commands.

Can be easily done in a batch file, like the following:

@If [%Debug%]==[] Echo Off
Set Hour=%1
Set Minute=%2
Set Increment=%3
Set Iterations=%4
Set i=1

    If /I %I% GTR %Iterations% Goto End
    Echo AT %Hour%:%Minute% "mypath\"
    Set /A Minute=Minute+Increment
    If /I %Minute% LSS 60 Goto Iteration
    Set /A Minute=Minute%60
    Set /A Hour+=1
    If %Hour% GTR 24 Goto End

    Set /A I+=1
    Goto Loop


It takes 4 parameters:
hour to start
minute to start
time invrement
number of repetitions

Note: probably you need to add another calculation to work with am/pm data instead of 24 hour data.

andyalderSaggar maker's framemakerCommented:
Why not run it as a batchfile loop instead of using AT with "sleep 295" (if it takes 5 secs to run).
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

the reason can be that you do not have anyone logged on to a system using AT, where a batch job with a sleep in it needs a user session (locked i hope).
So you will end up using AT to start the batch that has soon.exe or sleep in it.
andyalderSaggar maker's framemakerCommented:
But you can get the batch file to run as a service so it runs without a user logged in. But anyway, the Q is about AT so my comment is not really relevant. Armin's batch method of submitting multiple AT commands to the scheduler looks less work than typing the command 4800 times though.
I've used all of above in past, but not lately.  I liked WinAT for most work, sometime callin a .bat that had 'soon' et al.

I just want to remind here, that we are talking about files that do not come with NT CD, they are on the CD for the ResourceKit.  

Also bear in mind that NT 'does not respect' batch files. What I mean is, that there is never a guarantee that at the end of a batch file the system (processes/components/services - etc) will 'look' the same as when the batch file has begun. Even for 'scheduled' batch files. Even AutoExec.
A batch file and sleep.exe or wait.exe indeed is a simple but not a very good approach, because it stops executing as soon as you log out.

Generally there are two approaches:

one like mine, where you preset a series of at commands. you set up the whole thing once, get lots of at statements, but if you wish you can always use the /every:mon,tue,wed ... parameter to get it repeated every day.

another one is execute a batch file via at that does the job and then issues another at statement to schedule itself in the future. This is more difficult because you'd have to determine the current time, and there is no command I know of to (easily) set the current time into the environment.

btw: When I did use WinAT, it did run batch w/o login. It is thus, running more as a Super - so beware on that, either don't let it stay too much from a fixed path, or look up/mod the priveleges for what it runs under.

My purposes were moving data files around and converting formats like csv. Including mere simple 'copy' commands, intended to make files available to users without need of login through managed share.

For arminl, I think you state this correctly for generic NT. But soon is not generic, and with it comes WinAT. WinAT is what I used to run .bat that contained 'soon' and the like.  Later on I quit using soon because I found the other options in WinAT gave me what my model needed.  So, have you run it much? If not, try, you may like it for doing what you describe for NT4.

For others. The same arguments arminl suggest also led me to another section of ResourceKit - KixStart.  It is a little involved for what I needed, but it is like getting enhancements do do stuff in batch files while being cognizant of NT centricity.  Don't try to figure that out, RTFM, I think the CD makes it clear enough if you like to run .bat's, soon, and would like to check in on potential added features.

To date I have not heard one peep of a single other person ever trying it, and don't know why.  I used it little, and kept it mainly to assist me in maintaining a file system for DayOfWeek (ie, seven 'backups' ready on HD of the above mentioned data moved to 'public').

(repeating, this is my history, I am not directly involved any more in that piece of pie)
[we may have ignored recursion. ie, AT can be used to start the bat at midnight, the .bat can have any of: soon, at, and a call of the same .bat - eg recursive, although use of AT inside the .bat to reschedule the .bat is a tad recursive as well. Meaning it needs the management/admin heads up, for it never ends, and that should be prepared for up front. But the same could be said for 'every 5 minutes'.  If the code is incorrect or misbehaves, it could lock you out, so mentally address the 'unlock' process before running the program.]
Maybe there is a better way than using AT for what I want to accomplish.  

What I would like is for a visual basic script to run and extract data out of a database every 5 or so minutes.  This data is then read into the web page by a SSI.

I could just make the calls to the database from the web page, and I very well may have to.  However, the person who maintains our web page is not up to speed with ASP at this time.  Since our page changes so much, I would constantly have to keep re-working the asp code to accomodate the page.  I was hoping to save myself a little time..

So I thought of using the AT command in this instance.

Right now it seems armin's answer is the best, unless someone can come up with some other idea?


I misunderstand. You should probably surf VB topic, I think the answer for you is already there, so you need not reask is you can search it out.

As indicated above, I vote WinAT for NT of old. For VB app., armin's answer is similar to mine (sorry armin, don't want to put words in your mouth).

Many developers 'like' add-ons to language like ActiveX, so running timer inside of VB is preferable for some. Like AT command, it is not fully functional for all situations, but for a 5 minute alarm you should be able to get some code up quick.  So if you are into that, try <F1> or VB topic search, I am sure you'll be satisfied.

I need to move on for awhile, but I intend to come back, for I want to tell you why I'd still use either WinAT or AT as opposed to VB timer for situation you describe. (simply put, if you are not aware, AT and WinAT are same program/functionality, one gives you a windows interface, the other runs from command line, so is easier to manage, control and is only option herein for placement in a batch  file).
Right with soon.exe, I mixed it up with sleep.exe. Indeed much simpler, but calculating times in a batch is fun, isn't it?

Also agree 100% to using kix32, I use it a lot myself, and it did give me the most wonderful login scripts in the world (I think ...).

Winat is just" a graphical user interface for at, and at commands run regardless of wether someone is logged in or not.

> I mixed it up with sleep.exe

Ahh, that's the other one.  I did both at same time, and recall not whether any problem with either.  

I went with WinAT as the prime more because my production need became for daily job, and the interface made it rather trivial to set up for bunches of ad-hoc tests.  Access to the quick visual window of job status, a couple menu options, and IMHO worth the cost of another CD in and of itself as an 'improvement' over the DOS AT. I wwill never say fully functional or even more functional than AT.  For the things I like about the windows world, it had 'em.  

Then, w/CD you get other little bennies like WinIPcfg (!?) KixStart and more.  But I only ran limited use for my purpose, and long enough ago the memory fades.

> calculating times in a batch is fun, isn't it?

YUP! wholeheartedly agree on that. I did the soon/sleep thing in many mixtures, in fewer lines (no input), hardcoding the times followed by the infinite loop. Good thing my job does not depend on getting it right the first time.  But when it kicks in every five minnutes on schedule, voila, the excitement is back.  If you emulate that style of brevity, and the code lasts more than a week, I highly recommend adding some REM's as refresher for where that big number comes from and what it is suppsed to translate to in real time.

But where are we now in the initial question? There have been many good responses here, were any applicable to the questioner's situation?

Where are you on this, these comments?
RU Done?
one thing is not clear to me, you say winat has more functionality than AT??
I read you last comment twice, and I believe that is what you are writing.
(so please correct me if I am wrong on this statement).

This cannot be the case, because winat is only a frontend for AT, as the program soon.exe is.
Both are only convenient way's of using the Scheduler service.
On one thing I aggree, while we are discussing our heads off larockd has probebly solved his problem with one of the sugestions given by one of us.
wlaarhov, (and in part for Gretchen)
I am not currently involved with it, so this is memory item, and I may misspeak at times, but I cannot recall different 'function' in WinAT compared to AT, there may be one, but for my former design they were equal in 'function' I needed, and they are said to be so by reputation. I simply cannot recall. My preference went to the one with Windows interface for my need. I like the quick add-in, the quick view verifying jobs, the easy typing and checkboxes, -- all that stuff. Menu options may vary but who cares here. For scheduling features required by a project, they should be treated equivalent enough. But here's an alternative view to my Winoze preference:

AT would thus be 'as functional' as WinAT and does not require the additional CD. Given that NT is infamous for lack of remote access features, but does have some 'not fully functional' capability to remotely drop off some DOS commands, for this example, the AT command, there are also very good reasons to prefer the DOS version in addition to being able to include it in a batch file, like even AutoExec (although in that one there should be more plans on timing issues, so adding in another wait loop with the likes of the sleeper utilities give added reason to get the CD even if WinAT is not used).

I recall checking that it did in fact work, running AT through so-called remote access, but as I did not incorporate it with the production implementation, I had forgotten about it. But many admins are yet faced with managing boxes from a distance, so this use of AT should be among considerations, and may be factor behind some of the comments above.

[footnoting that 'WinAT' can be used from a separate unit (distant, but not remote access), but I believe the networking aspects are dissimilar, ie one can be contingency for the other.]

For all, do remember also we are addressing two separate functions. One is the timing thing, the other is the method used to start the timing thing.

Example, AT command can be scheduled to run an AT command, soon, even a VB program that has a timer. Yet, 'something' has to start up the first command to 'get the ball rolling'. This is a very very separate issue, for either it is an OLD schedule that we ASSUME is in effect still, or someone has to get into the system and start/validate the process.  Hence my distinction on access from other than a server console, and inclusion of non-login (script) accessibility.
larockdAuthor Commented:
I am still here, I have just been sitting back and reading the comments.

The problem for me is that I have to take into consideration that this server will be in another state.  So I need something reliable, that once set it will always work and if the machine is rebooted it will start right back.

So my footnote on 'Remote' may be more appropriate that I thought.

But I have no clue on what the possible value is for you here.  Every five minutes is often found to be a big overkill, unless data would otherwise be lost.

I'd say stage it, break into pieces.

At a minimum, placement of anything in an autoexec or runonce or start folder, what have you, probably 'should' have a different timing strategy. Five minutes is cutting it a little close at bootup, I'd give the 'launcher' piece an additional preplanned delay, such as another 5 minutes or so at the least. Do you have the CD? I'd consider test of autoexec-ing the AT command, at end of it, with some sleeper commands leading off. Nit that I would do or recommend, as I am not really thinking too deeply, but the SunBow persona likes variety and long pick lists of choices for such matters. So I say I'd consider.

Main two reasons is desire to also establish, or pre-establish all remote access capabilities including DOS command line / non-windows login.  From dos command line you can edit a batch file like autoexec, make the latest changes of the week, and relaunch the batch file if you want to without having to reboot.  Call that the 'edit & run' philosophy.

I still promote WinAT easy & 'pretty' view of the jobs.  Back then I could quickly view exactly what was going on with these jobs, were they scheduled (still?) or not, resubmit, change schedule, etc. It is not first choice for periods under a day, but a 2nd .bat file, that say waits a while, can schedule itself, can schedule a 'program' to run, or, simply loop on itself should be among consideration. If it uses scheduler, that means the scheduler can give you the latest view of 'current state' of the process. That's why I'd favor it over a simple bat: wait five minute, run progrm 1.exe, repeat from top.  Something that brief gives less of a feel for status from a remote location.

I am assuming you can remotely browse, map, and drill down into some directories already through Windows.

There's a much neater way of doing this using the batch parameter %0 and soon.exe

You can write a batch file which goes like this:

soon 300 %0
[rest of the batch file]

%0 is the command line used to execute the batch file, so make a shortcut which runs:

cmd /c [pathandnameofyourbatchfile]

Then the batch file schedules itself to run in 5 mins time every time it runs.  This means that you don't have a resource hungry NTVDM running all the time.
Hi larockd,
we use in our company a thing like you want to. We have to start each hour a batchjob.

Due to the AT-command cant do this we use the task scheduler coming with the internet explorer 5  (use better the 5.01) This is the replacement of the NT-AT command. (but the AT commands are still working after ie5 installation)

E.g. there you can setup a job that starts at 0:00 until 23:59 and repeats each 5 minutes.

But you can't setup it with a batch or command line. You have to do it manually over "my compuer", "scheduled tasks".

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Hi larockd,
some more comments:
the task scheduler is like the AT scheduler a nt service. It is automatically restarted if you boot the machine.

hope it helps
You did it again,
You are not right (again?) Task scheduler is not a replacement, but an extention of AT.
It runs as a service but only under the user context you started it.
And as we learned from experience the task scheduler (although it builds on AT) is not as stable as AT itself.

And yes it can be done with the standard scheduler service (at with or without a batch) as numerous examples have shown here.
You just are not smart enough with batches thats all.
Does NT run on IE5?
I hear of many problems with people trying to run the task scheduler coming with the internet explorer 5. I have not tried.

But AT command is fine enough. preference in WinAT, of course.
If you know DOS is still there, you can batch that AT's just fine, even with a soon if you like.

So I ditto wlaarhov
larockdAuthor Commented:
wlaarhov ,

When you said

It runs as a service but only under the user context you started it.

what do you mean by the user context it was started?  If I created te task under admin would it run even when admin is logged off?

where can I get a copy of soon and winat from.  I do not personally have the NT 4 resource kit and I woul dliek to try those to accomplish my task.

Correct, when starting a job you have to enter the name and password for the job, and therefore are under the security content of the one just entered. This can even be administrator.

BUT be ware, if someone knows what the administrator is going to start and when, it can lead to a security leak.
So this is fine if the machine running the task is in a controlled environment.

And you have to run IE5.01 minimum, or there is a known security leak with the task scheduler.

Soon and winat are a part of the NTreskit, and if you have to manage more than 2 NT machines, purchase a copy of it.
It is really not expensive, and it keeps you off the street for days of fun.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Networking

From novice to tech pro — start learning today.