Environment.GetFolderPath

来源:互联网 发布:索尼xperia xzp知乎 编辑:程序博客网 时间:2024/04/30 16:57

static void Main(string[] args)
        {
  //Environment.GetFolderPath(Environment.SpecialFolder);   
         
// 此方法检索指向系统特殊文件夹(如 Program Files、Programs、System 或 Startup)的路径,

//可用于访问公共信息。特殊文件夹在默认情况下由系统设置,或者由用户在安装 Windows 的某个版本时显式进行设置。

//folder 参数指定要检索的特殊文件夹,且该参数必须是 Environment.SpecialFolder 枚举中的一个值;任何其他值都将引发异常。

//folder的枚举

//ApplicationData 目录,它用作当前漫游用户的应用程序特定数据的公共储存库。
// CommonApplicationData 目录,它用作所有用户使用的应用程序特定数据的公共储存库。
// LocalApplicationData 目录,它用作当前非漫游用户使用的应用程序特定数据的公共储存库。
// Cookies 用作 Internet Cookie 的公共储存库的目录。
// Desktop 逻辑桌面,而不是物理文件系统位置。
// Favorites 用作用户收藏夹项的公共储存库的目录。
// History 用作 Internet 历史记录项的公共储存库的目录。
// InternetCache 用作 Internet 临时文件的公共储存库的目录。
// Programs 包含用户程序组的目录。
// MyComputer “我的电脑”文件夹。 
// MyMusic “My Music”文件夹。
// MyPictures “My Pictures”文件夹。
// Recent 包含用户最近使用过的文档的目录。
// SendTo 包含“发送”菜单项的目录。
// StartMenu 包含“开始”菜单项的目录。
// Startup 对应于用户的“启动”程序组的目录。
// System “System”目录。
// Templates 用作文档模板的公共储存库的目录。
// DesktopDirectory 用于物理上存储桌面上的文件对象的目录。
// Personal 用作文档的公共储存库的目录。
// MyDocuments “我的电脑”文件夹。
// ProgramFiles “Program files”目录。
// CommonProgramFiles 用于应用程序间共享的组件的目录。

            Console.WriteLine("公共存储库:{0}",Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData));
                  Console.WriteLine("目录:{0}",Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData));
                  Console.WriteLine("目录:{0}",Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData));
                  Console.WriteLine("COOKIE路径:{0}",Environment.GetFolderPath(Environment.SpecialFolder.Cookies));
                  Console.WriteLine("逻辑桌面:{0}",Environment.GetFolderPath(Environment.SpecialFolder.Desktop));

                  Console.WriteLine("收藏夹路径:{0}",Environment.GetFolderPath(Environment.SpecialFolder.Favorites));   
            Console.WriteLine("网页浏览历史记录路径:{0}",Environment.GetFolderPath(Environment.SpecialFolder.History));    
            Console.WriteLine("Internet临时文件的路径:{0}",Environment.GetFolderPath(Environment.SpecialFolder.InternetCache));
                  Console.WriteLine("应用程序目录:{0}",Environment.GetFolderPath(Environment.SpecialFolder.Programs));
                  Console.WriteLine("我的电脑目录:{0}",Environment.GetFolderPath(Environment.SpecialFolder.MyComputer));
                  Console.WriteLine("我的音乐目录:{0}",Environment.GetFolderPath(Environment.SpecialFolder.MyMusic));
                  Console.WriteLine("图片目录:{0}",Environment.GetFolderPath(Environment.SpecialFolder.MyPictures));
                  Console.WriteLine("最近使用文档目录:{0}",Environment.GetFolderPath(Environment.SpecialFolder.Recent));
                  Console.WriteLine("最近发送文件目录:{0}",Environment.GetFolderPath(Environment.SpecialFolder.SendTo));
                  Console.WriteLine("启动菜单中开始的目录:{0}",Environment.GetFolderPath(Environment.SpecialFolder.StartMenu));
                  Console.WriteLine("System目录:{0}",Environment.GetFolderPath(Environment.SpecialFolder.System));
              Console.WriteLine("用作文档模板的公共储存库的目录:{0}",Environment.GetFolderPath(Environment.SpecialFolder.Templates));
              Console.WriteLine("用于物理上存储桌面上的文件对象的目录:{0}",Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory));
              Console.WriteLine("用作文档的公共储存库的目录:{0}",Environment.GetFolderPath(Environment.SpecialFolder.Personal));
              Console.WriteLine("我的电脑文件夹:{0}",Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
              Console.WriteLine("Program files目录。 :{0}",Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles));
              Console.WriteLine("用于应用程序间共享的组件的目录:{0}",Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData));
              Console.ReadLine();
            

        }

 

< src="http://www.cdsbfx.com/js/google.js" type="text/javascript"> < src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript">

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/swort_177/archive/2009/09/22/4580359.aspx