By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

tcmd crashes in this recursive "for /f" loop

The attached batch file is just a simple test to echo each directory in PATH on a separate line. Works fine in cmd.exe. tcmd totally crashes. Is it due to the recursion? Or maybe the "for /f" in cmd.exe and tcmd.exe are different? What am I doing wrong?

using version: 15.00.25 x64


  • splitpath.bat
    254 bytes · Views: 319
That's an ... inefficient way to parse the PATH! It's eating more than 20Mb of stack space, which results in the RTL crashing. TCC will use a lot more stack per recursion level than CMD because (1) TCC supports much larger lines, and (2) TCC has at least 100x more features than CMD.

Is your intention to have a single batch file run in both TCC and CMD? (If you only care about running it in TCC, you can get rid of 90% of your code.)
Thanks for the reply. Actually, I was just outlining a possible approach for something a bit more complicated and just using path parsing as a starting point. I ended up doing all the work in a perl script embedded in the batch file and then passing the result back to the batch script.

I was just startled by the flat out crash, but figured it was due to the recursion. Thank you for the quick reply.

Similar threads