Welcome!

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

SignUp Now!

Difference in "FOR /F" behavior (?)

Jul
24
0
I'm seeing a difference between CMD.EXE (W8.1/10) and TCC.EXE (v18.00.18), but I believe the difference has existed in prior versions as well. This may have been reported/discussed previously, but I couldn't figure out how to get the forum search to let me search on "FOR /F" without bailing.

CMD.EXE, when given the following input line:
> FOR /F "tokens=1 delims=.]" %i IN ("Microsoft Windows [6.2.9200]") DO (echo %i)
produces:
> echo Microsoft Windows [6
echo Microsoft Windows [6

In contrast, TCC.EXE when given the same input line produces nothing. Neither tokens nor delims options appear to matter in this. In other words:

> FOR /F "tokens=1 delims=.]" %i IN ("Microsoft Windows [6.2.9200]") DO (echo %i)

>

is the result. I was able to debug to determine that the presence of the open bracket character in the string to be parsed, even if done indirectly -- given a cmd "output.exe" that returns "[1]" as follows:

> output.exe
[1]

> FOR /F "tokens=1 delims=.]" %i IN (`output.exe') DO (echo %i)

>

Hope this helps you debug, and a fix or explanation would be very much appreciated, as this seems to be what's blocking TCC.EXE from running a particularly complex script I'd like it to run at my workplace. Unfortunately, in my case, the string returned is from a command, must contain '[' chars and cannot be replaced or reformatted, so some kind of workaround or fix is needed or I'm stuck.

Thanks!!
 

Similar threads

Back
Top