# Schedule a batch file.



## indom (Feb 4, 2004)

Hi,

This is the batch file I have created to delete files.

echo off
REM Batch file for removing the REPT files from the specified directory

rm -rf C:\\DDRIVE\\RD\\newfolder\\temp\\* 
cd \
pwd

echo All The files have been deleted

For every 15 minutes we get the data and it should be deleted at the 13th minute. 
can anyone pls tell me how to schedule this to meet the requirement of deleting files at every 13th minute daily. Iam failing in using the AT command. Guess the syntax am giving is wrong. we work on winnt.

Thanks,
Indom


----------



## Squashman (Apr 4, 2003)

I am kind of baffled at the commands you are using. *rm -rf* would be a linux command as well as the *pwd*.

And *c:\* would be a Windows Partition.

What exactly are you trying to do.


----------



## indom (Feb 4, 2004)

we are using windows Nt. Need to schedule a batch job that deletes files every 13 mins daily.
don't have much of handson on these OS commands. no wonder i mixed the commands.

pls help me with the code and scheduling syntax

thanks.


----------



## codejockey (Feb 11, 2002)

I suspect you are using the MKS Utilities (or similar product) for NT -- these utilities provide Unix/Linux commands and functionality in an NT environment. If that's true, you might have a look at the "at" command or the "crontab" command. On the assumption that you are using the MKS product, you will need a crontab entry such as:

13,26,39,52 * * * * /name-of-your-command > /path-to-logfile 2>&1

Note that this command will run name-of-your-command at 13, 26, 39 and 52 minutes past each hour (24 x 7). This is not the same thing as running the command every 13 minutes. 

I suspect you don't really mean to execute this command every 13 minutes. Instead, you may need to execute the command 13 minutes after any data arrives. However, if you really want to execute the command every 13 minutes, consider putting the timing logic in the script that does the deletion, so that the script wakes up every 13 minutes and deletes whatever it finds in the specified directory. You will need a loop and the sleep command to accomplish this. Be forewarned, however: your script will not be synchronized with data arriving, so it's entirely possible that your script could wake up and begin deleting data as it arrives, possibly even before it has been processed.

Hope this helps -- additional info appreciated.


----------



## indom (Feb 4, 2004)

Thanks a lot for your explanation.
Yeah running at 13,16,39 and 52 wud be better than going for every 13 mins.
Our clients want to run on winNT only. Though we have MKS, when i give crontab -l, it is giving "'crontab' is not recognized as an internal or external command, operable program or batch file."

While working with AT command am able to schedule it to run daily but unable to schedule it at 13,16,39,52 mins of hr daily.

In winnt i didn't find scheduler also like we have in win2k.


----------



## codejockey (Feb 11, 2002)

Apologies for suggesting a crontab solution. Since I don't run NT (and have not kept up with recent MKS releases), I wasn't sure what options might be available to you (although I believe recent MKS versions included crontab functionality for NT). Unfortunately, the at command is a more limited form of the crontab command, and typically doesn't offer the flexibility/functionality of crontab. If you must use only native NT commands, I won't be much help, being largely ignorant of the NT world (sorry).


----------



## vinod.bhanur (May 4, 2008)

hello friends. this is vinod.
my problem is , i want to execute batch file after every 15 min

how can i achieve this task plz suggest .


----------



## vinod.bhanur (May 4, 2008)

hello friends. this is vinod.
my problem is , i want to execute batch file after every 15 min in windows 

how can i achieve this task plz suggest .


----------



## TheOutcaste (Aug 8, 2007)

Posted to other thread


----------

