See "Program Files" on a 64-bit machine

In C #, how can I refer to the following places and not their hard coding?

  • Program Files (x86)
  • Program files
+6
c # special-folders program-files
source share
1 answer

You can use:

System.Environment.GetFolderPath(System.Environment.SpecialFolder.ProgramFiles); 

to get the program files folder on the computer. This will return everything that is correct for the running application. Therefore, for 32-bit applications on a 64-bit machine, it will return "C: \ Program Files (x86)" on the English version of Windows.

+13
source share