Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the Program Files directory?

Tags:

c#

I'm trying to get the Program Files directory in a 64-bit OS. This code below returns the same answer Program Files (x86):

Console.WriteLine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86).ToString());
Console.WriteLine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles).ToString());

Any help?

like image 575
Tabai smida Avatar asked Nov 23 '15 09:11

Tabai smida


People also ask

Where is my Program Files x86 folder?

On Windows editions that support x86 emulation, there are two directories for program files. The C:\Program Files directory is for programs in the native system bitness, and the the C:\Program Files (x86) directory is for programs that run under the x86-32 emulator.

How do I find Program Files in command prompt?

While in the command prompt type "cd\", then enter. From there type "cd\program" then hit the tab button until you see "c:\program files (x86)", then hit enter. then hit the tab button.

What is Program Files folder?

Program Files is the name of the directory or the standard folder in Windows where third-party applications are installed by default. An application installed in this folder has its own subfolder where all of its program data go.

How do I find the installed Program Files in Windows 10?

Go to File Explorer. Locate the file you've downloaded. Files you've downloaded are automatically saved in the Downloads folder. This folder is usually located on the drive where Windows is installed (for example, C:\users\your name\downloads).


1 Answers

You must run your program in 64 bit mode of course. Then this will print

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

Go to : Project > Your Project Properties... > Build > disable Prefer 32-bit

like image 184
M.kazem Akhgary Avatar answered Oct 11 '22 21:10

M.kazem Akhgary