As can be read above, I first solved this one using a batch script. Been optimizing it somewhat, but still takes a lot of time to do the calculus. So I gave PowerShell a shot. Here are the results:
CMD: 00h:09m:53s.996ms
PS1: 00h:00m:10s.815ms
I'd say PowerShell is somewhat faster
