problem with environment variable x86 vs. x64

Aug 2, 2011
258
4
Berlin, Germany
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.
 

rconn

Administrator
Staff member
May 14, 2008
10,886
97
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.
 
Aug 2, 2011
258
4
Berlin, Germany
Thank you for the explanation.
... (which is different for 32-bit and 64-bit -- that's Windows, not TCC) ...
That explains the inconsistent behavior.