CommonFilesFolder and CommonFilesFolder64

kochesag

Newcomer
Joined
May 29, 2010
Messages
2
Hi,
How do you get the CommonFilesFolder and CommonFilesFolder64?
For example:

C:\Program Files\Common Files\
C:\Program Files (x86)\Common Files\

In VB.NET on a x64 platform?
I know how to use Environment to get CommonFiles folder but it returns the x86 folder and not x64, maybe because my app is set to x86?

However, I need to get both paths correctly, anyway you know?
Please help, thanks :)
 
The Environment class exposes both a Environment.SpecialFolder.CommonProgramFiles and a Environment.SpecialFolder.CommonProgramFilesx86 - if you use these with the Environment.GetFolderPath method then on a 64bit os with an application built for x64 or AnyCpu then Environment.SpecialFolder.CommonProgramFiles should return the x64 path - if you are running an x86 build then it will return the x86 path.
 
Back
Top