well, for starters you can install the BASH (Bourne Again SHell) on a windows box. and then, write the script for the BASH shell.
Click here for a complete BASH reference guide (it's how I learned BASH scripting.
Now, you may very well run into the problem that Windows does not have any pattern matching programs (ie. grep), so, in that case,
write the script in Perl.
You'll need the pattern matching because, quite simply, I'm pretty sure the
and
commands will give you all the information you want, but you want ceratin bits, and want to filter through all the gunk in between.
Final answer: write a Perl script.