Yes, I still write batch files. Sue me.*
Here’s one version of my IF statement:
1: SET ProgRoot=%ProgramFiles%
2:
3: IF NOT "%ProgramFiles(x86)%" == "" (
4: SET ProgRoot=%ProgramFiles(x86)%
5: )
6:
7: ECHO %ProgRoot%
This will output:
C:\Program Files (x86
Yes, it’s missing the closing parenthesis.
Here’s another version:
1: SET ProgRoot=%ProgramFiles%
2:
3: IF NOT "%ProgramFiles(x86)%" == "" SET ProgRoot=%ProgramFiles(x86)%
4:
5: ECHO %ProgRoot%
And it will output:
C:\Program Files (x86)
That version is correct.
* Actually, please don’t sue me!