LoginSignup
1
1

More than 3 years have passed since last update.

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

Last updated at Posted at 2020-10-17
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
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1