Shell32.Folder.GetDetailsOf(..,..)有哪些可用选项?

我已经看到使用GetDetailsOf()来获取有关shell项目的详细信息的答案,但数字总是神奇的数字。

我查看了FolderItem和GetDetailsOf的文档但没有找到任何内容。 (后者中的列表并非适用于所有内容。它们不包括“描述”,“作者”,也不包括回收站删除日期…)

是否有一些方法可以返回项目的可能选项? 它被列在某个地方吗?

我意外地想到了这一点。 如果将null传递给GetDetailsOf则它将使用列名进行响应。 例如,使用cscript执行以下JScript:

 var shellapp = WScript.CreateObject("Shell.Application"); var folder = shellapp.NameSpace("D:\\"); for (var j = 0; j < 0xFFFF; j++) { detail = folder.GetDetailsOf(null, j); if (!detail) { break; } WScript.Echo("[" + j + "] = " + detail); } 

在我的Windows 10系统上,这输出:

 [0] = Name [1] = Size [2] = Item type [3] = Date modified [4] = Date created [5] = Date accessed [6] = Attributes [7] = Offline status [8] = Availability [9] = Perceived type [10] = Owner [11] = Kind [12] = Date taken [13] = Contributing artists [14] = Album [15] = Year [16] = Genre [17] = Conductors [18] = Tags [19] = Rating [20] = Authors [21] = Title [22] = Subject [23] = Categories [24] = Comments [25] = Copyright [26] = # [27] = Length [28] = Bit rate [29] = Protected [30] = Camera model [31] = Dimensions [32] = Camera maker [33] = Company [34] = File description [35] = Program name [36] = Duration [37] = Is online [38] = Is recurring [39] = Location [40] = Optional attendee addresses [41] = Optional attendees [42] = Organizer address [43] = Organizer name [44] = Reminder time [45] = Required attendee addresses [46] = Required attendees [47] = Resources [48] = Meeting status [49] = Free/busy status [50] = Total size [51] = Account name 

这与Windows 2000完全不同,详见检索扩展文件属性 。 顺便提一下,如果你传入一个不同的NameSpace那么你将获得不同的属性。 在我的例子中,我问的是驱动器D:上的文件可用的属性D:根据其格式可能会有所不同。

VBAfunction完成这项工作。 需要Microsoft Scripting Runtime和Microsoft Shell控件和自动化

 Function Propriétés(Chemin As String, Fichier As String) 'Chemin représente le chemin du dossier où se trouve le fichier MP3 'Fichier représente le nom du fichier mp3 avec l'extension Dim Shl As New Shell32.Shell Dim Rep As Shell32.Folder Dim fich As Shell32.FolderItem Dim aPropName() As String, i As Integer Set Shl = CreateObject("Shell.Application") Set Rep = Shl.Namespace(Chemin) Set fich = Rep.Items.Item(Fichier) For i = 0 To 1000 ReDim Preserve aPropName(i) aPropName(i) = Format(i, "000 : ") & Rep.GetDetailsOf(Null, i) If Len(Rep.GetDetailsOf(Null, i)) = 0 Then ReDim Preserve aPropName(i - 1) Exit For End If Next ' Create ouput file Dim Fso, MyFile Set Fso = CreateObject("Scripting.FileSystemObject") Set MyFile = Fso.CreateTextFile(Chemin & "\Prop Liste - " & Fichier & ".txt", True) MyFile.Write Join(aPropName, Chr(13)) MyFile.Close Set Fso = Nothing Set MyFile = Nothing Propriétés = aPropName Set Shl = Nothing Set Rep = Nothing Set fich = Nothing End Function