Program files environmental variables

Csaba Raduly
Tue Nov 23 09:52:18 GMT 2021

On Tue, 23 Nov 2021 at 10:02, john doe via Cygwin <> wrote:
> Cygwins,
> Is there a way to get the value of PROGRAMFILES(x86) and PROGRAMW6432 in
> Bash:

$ env | grep PROGRAMFILES
COMMONPROGRAMFILES=C:\Program Files\Common Files

These are the environment variables visible in my Cygwin environment.

echo "$PROGRAMFILES(x86)" is the equivalent of echo
"${PROGRAMFILES}(x86)" i.e. the value of $PROGRAMFILES, followed by
the fixed string "(x86)"

I tried

$ echo "${PROGRAMFILES(x86)}"
$ echo "${PROGRAMFILES\(x86\)}"

and bash outright refused them ("bad substitution"). So it may not be
possible to have an environment variable with ()s in its name.

You can get very substantial performance improvements
by not doing the right thing. - Scott Meyers, An Effective C++11/14 Sampler
So if you're looking for a completely portable, 100% standards-conformant way
to get the wrong information: this is what you want. - Scott Meyers (C++TDaWYK)

More information about the Cygwin mailing list