Discussion Locked

Scheduling through a script

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I am trying to find a way to schedule a file to be overwritten monthly on certain machines, I know how to specify the machines, but I don't know what kind of commands I can use to figure out the date (i.e. 4th Monday). I would like to do this through the logon script. I am running NT and 2K workstations.

3 replies

by timthetoolman

Hi,

If you're doing this in a batch file (rather than something more powerful like Perl) then you'll likely be using things like...

date /t > somefile.txt

and then...

E:\Documents and Settings\Tim Medhurst>date /t > temp.txt

E:\Documents and Settings\Tim Medhurst>type temp.txt
Tue 11/06/2002

E:\Documents and Settings\Tim Medhurst>for /f "tokens=1,2,3,4 delims=/ " %i in (
temp.txt) do echo %i %j %k %l

E:\Documents and Settings\Tim Medhurst>echo Tue 11 06 2002
Tue 11 06 2002

The for statement will read that file and tokenise the components of the date. You'll do the calculations based on the results of that.

do a for /?

for more information on how the for statement operates. Its quite powerful.

Cheers,
Tim.

This discussion is closed to new replies.