# execute a batch files



## vinod.bhanur (May 4, 2008)

hello friends. this is vinod. 

my problem is to execute a batch file after every 15 minutes in windows.

please help me out to archive this task. 

THANK YOU in advance.


----------



## devil_himself (Apr 7, 2007)

How To Schedule Tasks in Windows XP
http://support.microsoft.com/kb/308569


----------



## vinod.bhanur (May 4, 2008)

is there any code to write to execute a batch file for every 15 min in windows.

main problem is i wrote a set of command in text file and named it as "vinod.bat" as a result vinod batch file is created.So i want the set of commands to be executed for every 15 min and write the result of the commands to a file.

how can i do this .in how many ways i can do this. i tried by scheduling the task at every time i login to the system but its not working. plz suggest . THANK YOU.


----------



## devil_himself (Apr 7, 2007)

Is Your Script Working Correctly .. Post A Copy Of Your Script !

SCHTASKS - http://www.ss64.com/nt/schtasks.html


----------



## TheOutcaste (Aug 8, 2007)

*Control Panel | Scheduled Tasks | Add Scheduled Task*
Browse to your batch file
Set to run *Daily*
Set start time. If you want it to run on every quarter hour, 24 hours a day, pick the next hour and set the minutes to zero. If you just need it to run during work hours, set the hour to the time you want it to first run each day
Set for everyday, weekdays, or every X number of days
Give it a username and password to run with
Check the box to open advanced properties before you click finish

When the Properties box opens, click the Schedule tab then the advanced Button
Check Repeat Task, then set to every 15 minutes
If it's to Run 24 hours a day, set Duration to 24 hours, otherwise set it to how long each day, say 9 hours for an 8 hour workday with 1 hour lunch, or specify the time it's to stop each day.

Of course, the batch file must be working first

HTH

Jerry


----------



## vinod.bhanur (May 4, 2008)

hello first of all i thank all the members for giving me a solution. i completed my task by scheduling my task executing for every 15 mins. 

My another problem is i want to execute a batch file from another directory.

In Detail: my batch file is in c:\ for suppose it consists of set of cmds for execution . and i want to execute this batch file from d:\ in command prompt. so what cmds should i write in my batch file in order to execute from d drive. i hope u understood my question. for more clarity please post ... 


THANK YOU.


----------



## Squashman (Apr 4, 2003)

Type the full path to the batch file. If you are at the D: drive and what to execute a batch file on the C: drive.

D:\>c:\foldername\batchfile.bat


----------



## vinod.bhanur (May 4, 2008)

thank you for ur advice..


----------



## vinod.bhanur (May 4, 2008)

one more question is . As my batch file executed the out put of the commands are written into the files names as temp.txt. Each time it is executing and the out of the batch file is appending to that text file which i specified in the batch file . I want to write the out put of the batch file to the new file every time it is executed.How can i do this one and remove the older text file.


----------



## devil_himself (Apr 7, 2007)

add this line at the top

*if exist temp.txt del temp.txt *


----------

