在.net 2008中找到程序文件x86文件夹 [英] find program files x86 folder in .net 2008

查看:110
本文介绍了在.net 2008中找到程序文件x86文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从.net 2008中在Win 7 64位操作系统中找到程序文件(x86)文件夹?

How can I find program files (x86) folder in win 7 64 bit OS from .net 2008 ?

推荐答案

以下提供的函数将返回x86程序文件Windows的所有3个配置中的目录

32位Windows
在64位Windows上运行的32位程序
在64位Windows上运行的64位程序

Below provided function will return the x86 Program Files directory in all 3 of the windows configurations

32 bit Windows
32 bit program running on 64 bit Windows
64 bit program running on 64 bit windows

static string ProgramFilesx86()
{
    if( 8 == IntPtr.Size || (!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432"))))
    {
        return Environment.GetEnvironmentVariable("ProgramFiles(x86)");
    }

    return Environment.GetEnvironmentVariable("ProgramFiles");
}


这篇关于在.net 2008中找到程序文件x86文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆