Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

64bit OS上の32bitアプリで32bit/64bit両方のProgram Filesフォルダを取得

Program.cs
using System;

namespace ShowProgramFilesFolder
{
    class Program
    {
        static void Main(string[] args)
        {
            // for 32bit
            Console.WriteLine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86));
            // for 64bit
            Console.WriteLine(Environment.ExpandEnvironmentVariables("%ProgramW6432%"));
        }
    }
}
実行結果
C:\Program Files (x86)
C:\Program Files
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away