0

If i create a folder in windows and right click select properties and give some comment about it in the comment field. in C#, How do i get the comment for a folder ? Is there any "Comment" Property available ?

4

3 回答 3

2

据我所知,没有用于检索扩展文件信息的纯托管机制。您可以使用 COM 对象Shell.Application来检索它。

    Shell32.Shell shell = new Shell32.Shell();
    Shell32.Folder folder = shell.NameSpace(@"C:\temp\testprop");
    Shell32.FolderItem item = folder.ParseName("whatever.txt);
    string comment = item.GetDetailsOf("whatever.txt", 14);

http://technet.microsoft.com/en-us/library/ee176615.aspx

http://msdn.microsoft.com/en-us/library/bb787870%28v=vs.85%29.aspx

读/写“扩展”文件属性 (C#)

于 2011-06-15T03:04:06.997 回答
0

FileSystemObject is probably not the mechanism you want to use.

Suggest you study System.IO and look at File and FileInfo objects, as they are CLR based as opposed to FSO which, I believe, is still COM. FileInfo has an attributes collection that you can interrogate.

于 2011-06-15T01:58:30.957 回答
0

首先,在唯一的文件夹上创建评论,例如c:\mycoolfolder= I am cool。然后,使用Regedit在注册表中搜索I am coolc:\mycoolfolder。这可能会给你一些提示。

于 2011-06-15T02:07:08.900 回答