1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Difference in "FOR /F" behavior (?)

Discussion in 'Support' started by jwiede, Jun 19, 2015.

  1. jwiede

    Jul 5, 2012
    Likes Received:
    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)
    > 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

    > 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.

  2. rconn

    rconn Administrator
    Staff Member

    May 14, 2008
    Likes Received:
    TCC has never supported the CMD FOR string token parsing. There were reasons for that; however after looking at it again I realized that the parser rewrite in v17 made it possible now. I've added it to TC 18.00.19 (which will be uploaded shortly).

Share This Page