Code:
On a unix box I would write a k-shell script to take care of this..
Write a batch program in windows then..
I did not get what you exactly asked for?