forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Get the path to "Program Files" directory?

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Sat Jan 10, 2009 1:06 am    Post subject: Get the path to "Program Files" directory? Reply with quote

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
View user's profile Send private message
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1753
Location: Space and Time

PostPosted: Sat Jan 10, 2009 1:52 am    Post subject: Reply with quote

Sure. Here ya go.

%%pf = @REGREAD(LOCAL,SOFTWARE\Microsoft\Windows\CurrentVersion,ProgramFilesDir)

_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Sat Jan 10, 2009 4:06 am    Post subject: Reply with quote

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 Smile

~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
View user's profile Send private message
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1753
Location: Space and Time

PostPosted: Sat Jan 10, 2009 4:38 am    Post subject: Reply with quote

Sure no prob. How have ya been Garrett?
_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Aslan
Valued Contributor
Valued Contributor


Joined: 31 May 2001
Posts: 589
Location: Memphis, TN USA

PostPosted: Sat Jan 10, 2009 4:49 am    Post subject: Reply with quote

Ummm,

%P = @env(ProgramFiles)

Wink
Back to top
View user's profile Send private message Send e-mail
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Sat Jan 10, 2009 9:48 pm    Post subject: Reply with quote

Aslan wrote:
Ummm,

%P = @env(ProgramFiles)

Wink



Hmmmm, well, how lazy am I here.. do I want this short way that Aslan has shown us, or the longer way? Wink

Thanks Aslan Smile

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
Aslan
Valued Contributor
Valued Contributor


Joined: 31 May 2001
Posts: 589
Location: Memphis, TN USA

PostPosted: Sun Jan 11, 2009 1:13 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group