' FileProperties.vbs ' Provides all the information available on a given file ' ----------------------------------------------------------- Const ReadOnly = 1 Const Hidden = 2 Const System = 4 Const Archive = 32 ' Get the name of the file to query Dim fileName If WScript.Arguments.Count = 0 Then fileName = InputBox("Enter the FULLY-QUALIFIED name of the file:") Else fileName = WScript.Arguments.Item(0) End If If fileName = "" Then WScript.Quit End If ' Create the FSO object Set fso = CreateObject("Scripting.FileSystemObject") ' Attempt to get the file If Not fso.FileExists(fileName) Then MsgBox "Sorry, but the file doesn't exist!" WScript.Quit End If Set f = fso.GetFile(fileName) aText = Array("File Name:" & vbTab & f.Path, _ "Short Name:" & vbTab & f.ShortPath, _ "Type of file:" & vbTab & f.Type, _ "Created on:" & vbTab & f.DateCreated, _ "Accessed on:" & vbTab & f.DateLastAccessed, _ "Modified on:" & vbTab & f.DateLastModified, _ "Attributes: " & vbTab & FormatAttrib(f.Attributes), _ "Total Size: " & vbTab & f.Size) MsgBox Join(aText, vbCrlf) Function FormatAttrib(attr) str = "" If attr And Archive Then str = str & "Archive, " If attr And ReadOnly Then str = str & "Readonly, " If attr And Hidden Then str = str & "Hidden, " If attr And System Then str = str & "System, " str = str & "Normal" FormatAttrib = str End Function