Thursday, February 18, 2010
Wednesday, February 17, 2010
Script: Print file versions
Following is the VBScript for printing the versions for all the files in a directory:
' Pass the folder path as commanline argument.
' e.g. cscript D:\Temp > c:\files.csv
' Use the above format to run the script otherwise each
' and every file will b displayed in a messagebox
' Should do argument validation !!!!
strFolderName = WScript.Arguments.Item(0)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject ("Shell.Application")
Set objFolder = objShell.Namespace (strFolderName)
For Each folderItem in objFolder.Items
If "Application Extension" = folderItem.Type Or "Application" = folderItem.Type then
Wscript.Echo folderItem.Path & "," & objFSO.GetFileVersion(folderItem.Path)
End If
Next
PrintFileVersions.vbs is also available on google doc.
' Pass the folder path as commanline argument.
' e.g. cscript D:\Temp > c:\files.csv
' Use the above format to run the script otherwise each
' and every file will b displayed in a messagebox
' Should do argument validation !!!!
strFolderName = WScript.Arguments.Item(0)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject ("Shell.Application")
Set objFolder = objShell.Namespace (strFolderName)
For Each folderItem in objFolder.Items
If "Application Extension" = folderItem.Type Or "Application" = folderItem.Type then
Wscript.Echo folderItem.Path & "," & objFSO.GetFileVersion(folderItem.Path)
End If
Next
PrintFileVersions.vbs is also available on google doc.
Subscribe to:
Posts (Atom)