I have weird problem.
I`m using windows 7 enterprise sp1 64 bit.
I need to take Program files and Program files X86 directories path for my project. This is what I've done:
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);
but both of these lines returns Program files X86 folder.
How can I resolve it?
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.
Type "start [filename.exe]" into Command Prompt, replacing "filename" with the name of your selected file. Replace "[filename.exe]" with your program's name. This allows you to run your program from the file path.
This will work for x86, x64 or Any CPU configurations:
string programFiles = Environment.ExpandEnvironmentVariables("%ProgramW6432%"); string programFilesX86 = Environment.ExpandEnvironmentVariables("%ProgramFiles(x86)%");
Because using the environment variable ProgramW6432
will always return Program Files folder whereas ProgramFiles
will vary depending on your application compilation options.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With