| View previous topic :: View next topic |
| Author |
Message |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Sat Jan 10, 2009 1:06 am Post subject: Get the path to "Program Files" directory? |
|
|
I just realized after all these years that @windir() and the "Shell Folders" registry information does not include the path to the "Program Files" directory.
Does anyone know how to obtain this info from Windows without having to search drives for it? Remember, not everyone installs their Windows on the C:\ drive, as well, it is possible to even have a different directory for the programs to install into by default and not be named "Program Files".
But somewhere in Windows, this information is stored, but it's not the "Shell Folders" registry area for sure.
Maybe there's an api call?
Thanks in advance,
~Garrett _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Sat Jan 10, 2009 1:52 am Post subject: |
|
|
Sure. Here ya go.
%%pf = @REGREAD(LOCAL,SOFTWARE\Microsoft\Windows\CurrentVersion,ProgramFilesDir) _________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Sat Jan 10, 2009 4:06 am Post subject: |
|
|
| LiquidCode wrote: | Sure. Here ya go.
%%pf = @REGREAD(LOCAL,SOFTWARE\Microsoft\Windows\CurrentVersion,ProgramFilesDir) |
Well I'll be a Geoduck's Uncle!
Thanks a bunch LC
~Garrett _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Sat Jan 10, 2009 4:38 am Post subject: |
|
|
Sure no prob. How have ya been Garrett? _________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
Aslan Valued Contributor


Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Sat Jan 10, 2009 4:49 am Post subject: |
|
|
Ummm,
%P = @env(ProgramFiles)
 |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Sat Jan 10, 2009 9:48 pm Post subject: |
|
|
| Aslan wrote: | Ummm,
%P = @env(ProgramFiles)
 |
Hmmmm, well, how lazy am I here.. do I want this short way that Aslan has shown us, or the longer way?
Thanks Aslan  _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
Aslan Valued Contributor


Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Sun Jan 11, 2009 1:13 am Post subject: |
|
|
Here are a few more useful params to use with @env()
| Code: | ALLUSERSPROFILE
APPDATA
CommonProgramFiles (eg. C:\Program Files\Common Files)
COMPUTERNAME
HOMEDRIVE (Usually C:)
HOMEPATH (Usually the same as the current users profile directory)
LOCALAPPDATA (Vista)
LOGONSERVER
OS (Only useful for checking if the system is NT based or not)
PATH
ProgramData (Vista)
ProgramFiles
PUBLIC (Vista)
SESSIONAME (Useful with Terminal Server sessions)
SystemDrive
SystemRoot [Usually the same as @windir()]
TEMP
TMP
USERDOMAIN
USERNAME
USERPROFILE (Users profile directory)
WINDIR [Same as @windir()] |
|
|
| Back to top |
|
 |
|