<p>I'm using:</p>

<pre><code>FileInfo(
    System.Environment.GetFolderPath(
        System.Environment.SpecialFolder.ProgramFiles) 
    + @"\MyInstalledApp"
</code></pre>

<p>In order to determine if a program is detected on a users machine (it's not ideal, but the program I'm looking for is a right old kludge of a MS-DOS application, and I couldn't think of another method).</p>

<p>On Windows XP and 32-bit versions of Windows Vista this works fine. However, on x64 Windows Vista the code returns the x64 Program Files folder, whereas the application is installed in Program Files x86. Is there a way to programatically return the path to Program Files x86 without hard wiring "C:\Program Files (x86)"?</p>

One way would be to look for the "ProgramFiles(x86)" environment variable:
```
```
String x86folder = Environment.GetEnvironmentVariable("ProgramFiles(x86)");
```
```