Program files environmental variables

Eliot Moss moss@cs.umass.edu
Tue Nov 23 13:10:39 GMT 2021


On 11/23/2021 4:02 AM, john doe via Cygwin wrote:
 > Cygwins,
 >
 > Is there a way to get the value of PROGRAMFILES(x86) and PROGRAMW6432 in
 > Bash:
 >
 > $ echo $PROGRAMFILES; echo "$PROGRAMFILES(x86)"; echo $PROGGRAMW6432
 > C:\Program Files
 > C:\Program Files(x86)
 >
 > $ cmd.exe /C "echo %PROGRAMFILES% %PROGRAMFILES(x86)% %PROGRAMW6432%"
 > C:\Program Files C:\Program Files (x86) C:\Program Files
 >
 >
 > PROGRAMFILES works in Bash but not the other two.

PROGRAMW6432 exists in my Cygwin bash, and I know I did not set it
explicitly.  As for the x86 one, parentheses are not allowed in
bash variable names.  In principle one could set up, say,
PROGRAMFILESx86, however no path of that kind is around in my
bash.  It would be possible to read it out and setup the variable.
I found, for example, that this prints out the setting of the
variable (but with other gorp you'd have to edit out):

echo "echo %PROGRAMFILES(x86)%; exit" | cmd

I forget where these are set up - I think in the Cygwin code.
I'm sure someone else will point that out!

Best - Eliot


More information about the Cygwin mailing list