c# 获取文件夹名字,目录简介

staticvoid Main(string[] args)
        {
 //Environment.GetFolderPath(Environment.SpecialFolder);    

          
// 此方法检索指向系统特殊文件夹(如Program FilesProgramsSystem 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();
             

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值