Re: AT Command - Scheduling - Windows NT

This is a discussion on Re: AT Command - Scheduling - Windows NT ; "Thiko" wrote in message news:b8d3b40c.0306230754.7b0aa327@posting.google.c om... > Hi, i was wondering what the AT command syntax is for spefiying > something different to run on the same day of the week on a different > week of the month. > ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Re: AT Command - Scheduling

  1. Re: AT Command - Scheduling


    "Thiko" wrote in message
    news:b8d3b40c.0306230754.7b0aa327@posting.google.c om...
    > Hi, i was wondering what the AT command syntax is for spefiying
    > something different to run on the same day of the week on a different
    > week of the month.
    >
    > e.g.
    >
    > Run script 1 on the first tuesday of the month.
    > Run script 2 on the second tuesday of the month.
    > Run script 3 on the third tuesday of the month.
    > Run script 4 on the fourth tuesday of the month.
    >
    > Run script 5 on the first tuesday of the month.
    > Run script 6 on the second tuesday of the month.
    > Run script 7 on the third tuesday of the month.
    >
    > I know how to specify AT syntax for the same script each day:
    > e.g.
    >
    > AT 24:00/EVERY:M,T,W,Th,F,S,Su "D:\orant\BIN\backup.bat"
    >
    > I do not understand the AT help to do what i want to do.
    >
    > Is it possible?
    >
    > Many Thanks.
    >
    > Thiko!


    at.exe has no inbuilt facilities for detecting the first, second etc.
    Tuesday in a week. You must use some code inside your batch
    file to do this:

    @echo off
    SetLocal
    for /F "tokens=2 delims=/ " %%a in ('echo %date%') do set /a week=%%a / 7 +
    1
    echo You are in week no. %week%
    if %week%==1 call WeekOne
    if %week%==2 call WeekTwo
    if %week%==3 call WeekThree
    if %week%==4 call WeekFour
    EndLocal

    goto :eof

    --------------------------------------
    :WeekOne
    Script 1 goes here
    goto :eof

    --------------------------------------
    :WeekTwo
    Script 2 goes here
    goto :eof

    etc.

    Cut & paste this script into your backup file, then invoke it
    with this command:

    AT 0:05/EVERY:T "D:\orant\BIN\backup.bat"

    The script will run every Tuesday morning at 5 past midnight. It will
    execute Script 1 on the first Tuesday, Script 2 on the second Tuesday etc.

    Note that the script relies on the system environmental variable %date%
    having the following form:

    Tuesday 24/06/2003

    If your date format is

    Tuesday 06/24/2003

    then you must change token=2 to token=3 in your batch file.



  2. Re: AT Command - Scheduling

    Gosh. Sounds complicated Will get onto it right away. Many thanks
    for your help

    Thiko!

    "Pegasus \(MVP\)" wrote in message news:...
    > "Thiko" wrote in message
    > news:b8d3b40c.0306230754.7b0aa327@posting.google.c om...
    > > Hi, i was wondering what the AT command syntax is for spefiying
    > > something different to run on the same day of the week on a different
    > > week of the month.
    > >
    > > e.g.
    > >
    > > Run script 1 on the first tuesday of the month.
    > > Run script 2 on the second tuesday of the month.
    > > Run script 3 on the third tuesday of the month.
    > > Run script 4 on the fourth tuesday of the month.
    > >
    > > Run script 5 on the first tuesday of the month.
    > > Run script 6 on the second tuesday of the month.
    > > Run script 7 on the third tuesday of the month.
    > >
    > > I know how to specify AT syntax for the same script each day:
    > > e.g.
    > >
    > > AT 24:00/EVERY:M,T,W,Th,F,S,Su "D:\orant\BIN\backup.bat"
    > >
    > > I do not understand the AT help to do what i want to do.
    > >
    > > Is it possible?
    > >
    > > Many Thanks.
    > >
    > > Thiko!

    >
    > at.exe has no inbuilt facilities for detecting the first, second etc.
    > Tuesday in a week. You must use some code inside your batch
    > file to do this:
    >
    > @echo off
    > SetLocal
    > for /F "tokens=2 delims=/ " %%a in ('echo %date%') do set /a week=%%a / 7 +
    > 1
    > echo You are in week no. %week%
    > if %week%==1 call WeekOne
    > if %week%==2 call WeekTwo
    > if %week%==3 call WeekThree
    > if %week%==4 call WeekFour
    > EndLocal
    >
    > goto :eof
    >
    > --------------------------------------
    > :WeekOne
    > Script 1 goes here
    > goto :eof
    >
    > --------------------------------------
    > :WeekTwo
    > Script 2 goes here
    > goto :eof
    >
    > etc.
    >
    > Cut & paste this script into your backup file, then invoke it
    > with this command:
    >
    > AT 0:05/EVERY:T "D:\orant\BIN\backup.bat"
    >
    > The script will run every Tuesday morning at 5 past midnight. It will
    > execute Script 1 on the first Tuesday, Script 2 on the second Tuesday etc.
    >
    > Note that the script relies on the system environmental variable %date%
    > having the following form:
    >
    > Tuesday 24/06/2003
    >
    > If your date format is
    >
    > Tuesday 06/24/2003
    >
    > then you must change token=2 to token=3 in your batch file.


+ Reply to Thread