If it's a .bat file why have you tagged your question as if it involved PowerShell?
Try searching for "recursive bat exceeds STACK limits" using Bing/Google/etc. and you'll find lots of other people that have encountered this problem. What the problem is in your case only you can tell since you haven't posted the contents of the batch file.