Usage of AT Command

M

mannaikarthik

Hi,

I would like to schedule a job every 3 hours in a day (for e.g : 11 AM
,2 PM, 5 PM..)

We can achive this through "Advanced option" in GUI (Schedule Task) but
I want to do it via commands (Batch file)

I tried with regular commands, but no success

AT 2:00 /EVERY:M,T,W,TH,F,S,SU C:\TWset/Twset.exe

Can any one help me here ? and How to name this job ?
(If I create via GUI it showing "Twset" and if I create via commnad
prompt it showing "AT2"...)

Many Thanks.

Regards
Mannaikarthik.
 
P

Pegasus \(MVP\)

Hi,

I would like to schedule a job every 3 hours in a day (for e.g : 11 AM
,2 PM, 5 PM..)

We can achive this through "Advanced option" in GUI (Schedule Task) but
I want to do it via commands (Batch file)

I tried with regular commands, but no success

AT 2:00 /EVERY:M,T,W,TH,F,S,SU C:\TWset/Twset.exe

Can any one help me here ? and How to name this job ?
(If I create via GUI it showing "Twset" and if I create via commnad
prompt it showing "AT2"...)

Many Thanks.

Regards
Mannaikarthik.

The command

AT 2:00 /EVERY:M,T,W,TH,F,S,SU C:\TWset/Twset.exe

is correct although I would probably code it like so:

AT 14:00 /EVERY:M,T,W,TH,F,S,SU C:\TWset/Twset.exe

What makes you think that it does not work? Did you run
at.exe by itself to see the list of currently scheduled commands?

Instead of scheduling an executable file (which can be difficult
to debug), you should schedule something that is easy, e.g.
this batch file:

@echo off
echo %date% %time% Start of task > c:\test.log
echo User=%UserName%, Path=%path% >> c:\test.log
C:\TWset/Twset.exe 1>>c:\test.log 2>c:\test.err
echo ErrorLevel of C:\TWset/Twset.exe=%ErrorLevel% >> c:\test.log
echo %date% %time% End of task >> c:\test.log

Now have a look at the two log files. They will tell you a lot!
 
P

Pegasus \(MVP\)

True, but the OP can use at.exe to schedule several separate
tasks each day.
 
C

Colon Terminus

Pegasus (MVP) said:
The command

AT 2:00 /EVERY:M,T,W,TH,F,S,SU C:\TWset/Twset.exe

is correct although I would probably code it like so:

AT 14:00 /EVERY:M,T,W,TH,F,S,SU C:\TWset/Twset.exe

What makes you think that it does not work? Did you run
at.exe by itself to see the list of currently scheduled commands?

Instead of scheduling an executable file (which can be difficult
to debug), you should schedule something that is easy, e.g.
this batch file:

@echo off
echo %date% %time% Start of task > c:\test.log
echo User=%UserName%, Path=%path% >> c:\test.log
C:\TWset/Twset.exe 1>>c:\test.log 2>c:\test.err
echo ErrorLevel of C:\TWset/Twset.exe=%ErrorLevel% >> c:\test.log
echo %date% %time% End of task >> c:\test.log

Now have a look at the two log files. They will tell you a lot!

In addition to what Pegasus says, be aware that you would need to schedule
eight jobs. Starting at 02:00 and at every three hour interval thru 23:00.
 
P

Phil Robyn

Colon said:
The command

AT 2:00 /EVERY:M,T,W,TH,F,S,SU C:\TWset/Twset.exe

is correct although I would probably code it like so:

AT 14:00 /EVERY:M,T,W,TH,F,S,SU C:\TWset/Twset.exe

What makes you think that it does not work? Did you run
at.exe by itself to see the list of currently scheduled commands?

Instead of scheduling an executable file (which can be difficult
to debug), you should schedule something that is easy, e.g.
this batch file:

@echo off
echo %date% %time% Start of task > c:\test.log
echo User=%UserName%, Path=%path% >> c:\test.log
C:\TWset/Twset.exe 1>>c:\test.log 2>c:\test.err
echo ErrorLevel of C:\TWset/Twset.exe=%ErrorLevel% >> c:\test.log
echo %date% %time% End of task >> c:\test.log

Now have a look at the two log files. They will tell you a lot!


In addition to what Pegasus says, be aware that you would need to schedule
eight jobs. Starting at 02:00 and at every three hour interval thru 23:00.[/QUOTE]

Not necessarily. If you schedule a *batch file* that runs Twset.exe
instead of scheduling Twset.exe directly, the first scheduled batch file
can simply schedule its own next run by issuing another AT command,
usually just before it reaches its own logical end or exit point.
 
D

Dean Dark

I would like to schedule a job every 3 hours in a day (for e.g : 11 AM
,2 PM, 5 PM..)

We can achive this through "Advanced option" in GUI (Schedule Task) but
I want to do it via commands (Batch file)

I tried with regular commands, but no success

AT 2:00 /EVERY:M,T,W,TH,F,S,SU C:\TWset/Twset.exe

Can any one help me here ? and How to name this job ?
(If I create via GUI it showing "Twset" and if I create via commnad
prompt it showing "AT2"...)

ISTR from NT 4 days and the NT AT command run in batch mode that a
common failure is to do with permissions, i.e. where running the job
interactively is fine, but running in batch (as a service) mode
requires privileges that are not automatically inherited from the user
account that created it. There are surely MVPs here who know what I
mean and can explain it better than I can?
 
P

Pegasus \(MVP\)

Dean Dark said:
ISTR from NT 4 days and the NT AT command run in batch mode that a
common failure is to do with permissions, i.e. where running the job
interactively is fine, but running in batch (as a service) mode
requires privileges that are not automatically inherited from the user
account that created it. There are surely MVPs here who know what I
mean and can explain it better than I can?

If the OP runs the batch file I proposed in my first reply
then he will clearly see if this is a privilege issue or not.
Seeing that he has become very silent, I assume that he
has resolved his problem.
 
M

Mannai Karthik

Can you please elabrate bit ? Do I have to create 3 jobs at different
time ?

- MSK
 
P

Pegasus \(MVP\)

Mannai Karthik said:
Can you please elabrate bit ? Do I have to create 3 jobs at different
time ?

- MSK

Every 3 hours:
at 0:00 /every:m,t,w,th,f,s,su c:\tools\somejob.exe
at 3:00 /every:m,t,w,th,f,s,su c:\tools\somejob.exe
at 6:00 /every:m,t,w,th,f,s,su c:\tools\somejob.exe
at 9:00 /every:m,t,w,th,f,s,su c:\tools\somejob.exe
at 12:00 /every:m,t,w,th,f,s,su c:\tools\somejob.exe
at 15:00 /every:m,t,w,th,f,s,su c:\tools\somejob.exe
at 18:00 /every:m,t,w,th,f,s,su c:\tools\somejob.exe
at 21:00 /every:m,t,w,th,f,s,su c:\tools\somejob.exe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top