| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-Original-To: | cygwin AT cygwin DOT com |
| Delivered-To: | cygwin AT cygwin DOT com |
| DMARC-Filter: | OpenDMARC Filter v1.4.1 sourceware.org 840E33858D28 |
| Authentication-Results: | sourceware.org; dmarc=none (p=none dis=none) |
| header.from=SystematicSw.ab.ca | |
| Authentication-Results: | sourceware.org; |
| spf=none smtp.mailfrom=systematicsw.ab.ca | |
| X-Authority-Analysis: | v=2.4 cv=Fe4keby6 c=1 sm=1 tr=0 ts=619d2dd5 |
| a=T+ovY1NZ+FAi/xYICV7Bgg==:117 a=T+ovY1NZ+FAi/xYICV7Bgg==:17 | |
| a=IkcTkHD0fZMA:10 a=TImcKGuyeGIbufSLrCcA:9 a=QEXdDO2ut3YA:10 | |
| Message-ID: | <87a6c5cf-e34a-1dd4-eeee-5e9085a7558d@SystematicSw.ab.ca> |
| Date: | Tue, 23 Nov 2021 11:07:17 -0700 |
| MIME-Version: | 1.0 |
| User-Agent: | Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 |
| Thunderbird/91.3.2 | |
| Subject: | Re: Program files environmental variables |
| To: | cygwin AT cygwin DOT com |
| References: | <693ff161-60af-7e60-7325-ce0f2b42acc0 AT mail DOT com> |
| From: | Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca> |
| Organization: | Systematic Software |
| In-Reply-To: | <693ff161-60af-7e60-7325-ce0f2b42acc0@mail.com> |
| X-CMAE-Envelope: | MS4xfN0Y/tXuV2tAFtY5EBVUHhsf6dWT9RxMw6YwIHj/tM33V0nEClaN6TsTTMIcRp+0lOPka77/7U1E4jAb0DI9jWf8d3g6o1UisDX7nbEfQl8VwJAqRb8r |
| e406mUHbbSuLg9sSQ8aOppxzjV37aI4/BA5jMq4+QycUKPPCxwHW/usn6itEHafLOgcbG7YkUrjlhoWBKRG54BUjq3KKbXeCc+o= | |
| X-Spam-Status: | No, score=-1165.5 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, |
| KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_BARRACUDACENTRAL, | |
| RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, | |
| SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.4 | |
| X-Spam-Checker-Version: | SpamAssassin 3.4.4 (2020-01-24) on |
| server2.sourceware.org | |
| X-BeenThere: | cygwin AT cygwin DOT com |
| X-Mailman-Version: | 2.1.29 |
| List-Id: | General Cygwin discussions and problem reports <cygwin.cygwin.com> |
| List-Unsubscribe: | <https://cygwin.com/mailman/options/cygwin>, |
| <mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe> | |
| List-Archive: | <https://cygwin.com/pipermail/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-request AT cygwin DOT com?subject=help> |
| List-Subscribe: | <https://cygwin.com/mailman/listinfo/cygwin>, |
| <mailto:cygwin-request AT cygwin DOT com?subject=subscribe> | |
| Reply-To: | cygwin AT cygwin DOT com |
| Errors-To: | cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com |
| Sender: | "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com> |
On 2021-11-23 02:02, 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.
>
> I could not find anything relevent in the archive or when googling.
On my system under only the following Program... variables are exposed:
$ echo $ProgramData $PROGRAMFILES $ProgramW6432 # x64
C:\ProgramData C:\Program Files C:\Program Files
$ echo $ProgramData $PROGRAMFILES $ProgramW6432 # x86
C:\ProgramData C:\Program Files (x86) C:\Program Files
It is often a better idea to use cygpath options or Windows folder ids:
"System information:
-A, --allusers use `All Users' instead of current user for -D, -P
-D, --desktop `Desktop' directory
-H, --homeroot `Profiles' directory (home root)
-O, --mydocs `My Documents' directory
-P, --smprograms Start Menu `Programs' directory
-S, --sysdir system directory
-W, --windir `Windows' directory
-F, --folder ID special folder with numeric ID"
$ for f in {0..64}; do
p=`cygpath -UF $f 2> /dev/null` && [ -n "$p" ] && echo $f $p
done # sanitized
0 $HOME/Desktop
2 $HOME/AppData/Roaming/Microsoft/Windows/Start Menu/Programs
5 $HOME/Documents
6 $HOME/Favorites
7 $HOME/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup
8 $HOME/AppData/Roaming/Microsoft/Windows/Recent
9 $HOME/AppData/Roaming/Microsoft/Windows/SendTo
11 $HOME/AppData/Roaming/Microsoft/Windows/Start Menu
13 $HOME/Music
14 $HOME/Videos
16 $HOME/Desktop
19 $HOME/AppData/Roaming/Microsoft/Windows/Network Shortcuts
20 /proc/cygdrive/c/Windows/Fonts
21 $HOME/AppData/Roaming/Microsoft/Windows/Templates
22 /proc/cygdrive/c/ProgramData/Microsoft/Windows/Start Menu
23 /proc/cygdrive/c/ProgramData/Microsoft/Windows/Start Menu/Programs
24 /proc/cygdrive/c/ProgramData/Microsoft/Windows/Start
Menu/Programs/StartUp
25 /home/Public/Desktop
26 $HOME/AppData/Roaming
27 $HOME/AppData/Roaming/Microsoft/Windows/Printer Shortcuts
28 $HOME/AppData/Local
29 $HOME/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup
30 /proc/cygdrive/c/ProgramData/Microsoft/Windows/Start
Menu/Programs/StartUp
31 $HOME/Favorites
32 $HOME/AppData/Local/Microsoft/Windows/INetCache
33 $HOME/AppData/Local/Microsoft/Windows/INetCookies
34 $HOME/AppData/Local/Microsoft/Windows/History
35 /proc/cygdrive/c/ProgramData
36 /proc/cygdrive/c/Windows
37 /proc/cygdrive/c/Windows/System32
38 /proc/cygdrive/c/Program Files
39 $HOME/Pictures
40 $HOME
41 /proc/cygdrive/c/Windows/SysWOW64
42 /proc/cygdrive/c/Program Files (x86)
43 /proc/cygdrive/c/Program Files/Common Files
44 /proc/cygdrive/c/Program Files (x86)/Common Files
45 /proc/cygdrive/c/ProgramData/Microsoft/Windows/Templates
46 /home/Public/Documents
47 /proc/cygdrive/c/ProgramData/Microsoft/Windows/Start
Menu/Programs/Administrative Tools
48 $HOME/AppData/Roaming/Microsoft/Windows/Start
Menu/Programs/Administrative Tools
53 /home/Public/Music
54 /home/Public/Pictures
55 /home/Public/Videos
56 /proc/cygdrive/c/Windows/Resources
59 $HOME/AppData/Local/Microsoft/Windows/Burn/Burn
These output nothing:
$ printenv 'Program Files (x86)'
$ printenv 'ProgramFiles(x86)'
--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]
--
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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |