我正在寻找一种方法来获取有关Application文件的所有信息,这些信息位于file属性的details选项卡中。 我知道Windows 8中关于303的所有属性当然都没有信息,这就是我想要的:
我要求在vbscript的文件属性详细信息中提供文件,应用程序或媒体文件的所有可用有效信息。
答案 0 :(得分:3)
使用此脚本将获取有关文件的所有信息。所有详细信息文件属性
该属性的编号从0到303 ....(或更多我没有真正知道该文件在所有操作系统中有多少个属性)。
On Error Resume Next
sFolder = "C:\Program Files\Windows Media Player" 'type path of folder contain the file
Set objShell = CreateObject("Shell.Application")
Set Dir = objShell.Namespace(sFolder)
For Each FileName in Dir.Items
If inStr(1,FileName ,"wmplayer",1) > 0 Then 'here write the name of file
For i = 0 To 400 'every digit is attribute for the file
If Trim(Dir.GetDetailsOf(FileName, i)) <> "" Then
wscript.echo i & " - " & Dir.GetDetailsOf(Dir.Items, i) & vbTab & "= " & Dir.GetDetailsOf(FileName, i)
End If
Next
wscript.quit
End If
Next
新更新:
1 。添加文件扩展名
2 。在文本文件中显示结果
有时,文件夹中具有多个具有相同扩展名的文件具有相同的名称,因此,如果要在其中一个文件,请使用此脚本作为文件扩展名的中继
On Error Resume Next
Dim myFile,myFolder,myPathToFolder,OpenTextToWrite,sFile,myExtension,getExtension
myFile="wmplayer"
myExtension="exe"
myPathToFolder= "C:\Program Files\Windows Media Player"
Dim ShApp : Set ShApp =CreateObject("Shell.Application")
Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
Dim sh : Set sh =CreateObject("WScript.Shell")
If WScript.Arguments.Length=0 Then
ShApp.shellexecute "cscript.exe ",Chr(34)&WScript.ScriptFullName&Chr(34)&" HOLLOPOST",Null,"runas",0
WScript.Quit
End If
myText=fso.GetSpecialFolder(2)&"\pro.txt" '' 2for temp folder
Set myFolder = ShApp.Namespace(myPathToFolder)
For Each sFile In myFolder.Items
getExtension= CreateObject("wscript.shell").Exec("cmd.exe /c dir /b """&myPathToFolder&""" | find /i """&myFile&"""" ).StdOut.ReadLine
If instr(1,sFile ,myFile,1) > 0 And Right(getExtension,3)=myExtension Then
Set OpenTextToWrite= fso.OpenTextFile(myText, 2, True)
For i = 0 To 241
If Trim(myFolder.GetDetailsOf(sFile, i)) <> "" Then
OpenTextToWrite.WriteLine i & " - " &vbTab & myFolder.GetDetailsOf(myFolder.Items, i) & " : "& myFolder.GetDetailsOf(sFile, i)
End If
Next
End If
Next
OpenTextToWrite.Close
ShApp.Open myText
答案 1 :(得分:0)
使用WshHShell
FileSystemObject
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile=objFSO.GetFile("C:\Program Files\Windows Media Player\wmplayer.exe")
wscript.echo "Date created: " & objFile.DateCreated & vbCrlf & _
"Date last accessed: " & objFile.DateLastAccessed & vbCrlf & _
"Date last modified: " & objFile.DateLastModified & vbCrlf & _
"Drive: " & objFile.Drive & vbCrlf & _
"Name: " & objFile.Name & vbCrlf & _
"Parent folder: " & objFile.ParentFolder & vbCrlf & _
"Path: " & objFile.Path & vbCrlf & _
"Short name: " & objFile.ShortName & vbCrlf & _
"Short path: " & objFile.ShortPath & vbCrlf & _
"Size: " & objFile.Size & vbCrlf & _
"Type: " & objFile.Type
答案 2 :(得分:0)
使用 rx.modelDeselect
获取文件属性:
selectItem(at:animated:scrollPosition:)