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

problem with environment variable x86 vs. x64

Discussion in 'Support' started by Frank, Aug 2, 2012.

  1. Frank

    Joined:
    Aug 2, 2011
    Messages:
    258
    Likes Received:
    4
    With TCC v.14 x64 I get the expected result:

    Code:
     
    C:\Temp >ver
     
    TCC  14.00.30 x64  Windows 7 [Version 6.1.7601]
     
    C:\Temp >set | findstr /i /b programfiles
     
    ProgramFiles=C:\Program Files
    ProgramFiles(x86)=C:\Program Files (x86)
     
    C:\Temp >echo pause `"%ProgramFiles(x86)%"` > getpf.btm
     
    C:\Temp >type getpf.btm
     
    pause "%ProgramFiles(x86)%"
     
    C:\Temp >getpf
     
    pause "C:\Program Files(x86)"
    "C:\Program Files(x86)"
     
    C:\Temp >
    
    But with the x86 version it looks like this:

    Code:
    C:\Temp >ver
     
    TCC  14.00.30  Windows 7 [Version 6.1.7601]
     
    C:\Temp >set | findstr /i /b programfiles
    ProgramFiles=C:\Program Files (x86)
    ProgramFiles(x86)=C:\Program Files (x86)
     
    C:\Temp >getpf
     
    pause "C:\Program Files (x86)(x86)"
    "C:\Program Files (x86)(x86)"
     
    C:\Temp >
    
    What's wrong?

    edit:
    oops - just did a cold reset of my brain.
    Code:
    pause "%[programfiles(x86)]%"
    "C:\Program Files (x86)"
    is ok.
     
  2. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,029
    Likes Received:
    84
    The parentheses are not considered valid variable name characters, so the name parsing is stopped at the first '('. The remaining "(x86)" gets appended to the value returned by "%ProgramFiles" (which is different for 32-bit and 64-bit -- that's Windows, not TCC).

    You need to use the %[xxx] syntax.
     
  3. Frank

    Joined:
    Aug 2, 2011
    Messages:
    258
    Likes Received:
    4
    Thank you for the explanation.
    That explains the inconsistent behavior.
     

Share This Page