On 11/23/2021 10:37 AM, Daniel Abrahamsson wrote:
John Doe 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.
I could not find anything relevent in the archive or when googling.
--
John Doe
We have a script where we use this workaround:
PROGRAMFILES86=$(env | sed -ne 's/^ProgramFiles(x86)=//p' )
I never thought using env like this, an alternative using awk:
$ env | awk -F= '/^ProgramFiles\(x86\)/{print $2}'
C:\Program Files (x86)
printenv is even better! :)
Thanks all for your input much appreciated.
--
John Doe
--
Problem reports: https://cygwin.com/problems.html
FAQ: https://cygwin.com/faq/
Documentation: https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple