Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to read File Description in VBS ??

Status
Not open for further replies.

Mirdus0001

Technical User
Aug 25, 2003
29
CZ
Hi all,

is there a way in VBS to read Description of a file e.g. for xy.exe ??

I have on mind the Description information available at "Version" page when right click a file and choosing Properties.

I cannot find it on the web. It's all the time about atributes, last modif date, version... But no mention about Description.

Can anyone advice on this?
Thanks and regards
 
Have you searched or tried DSOFile??? It is NOT just for MS Docs like some seem to believe. It will allow you to read and set certain properties on other types of files as well.

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
Give this a try:

Code:
'==========================================================================
'
' NAME: GetFileDetails.vbs
'
' AUTHOR: Mark D. MacLachlan , The Spider's Parlor
' URL: [URL unfurl="true"]http://www.thespidersparlor.com[/URL]
' DATE  : 8/27/2007
' COPYRIGHT (c) 2007 All Rights Reserved
'
' COMMENT: Binds to a folder and then a file and lists extended file details.
'
'    THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
'    ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
'    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
'    PARTICULAR PURPOSE.
'
'    IN NO EVENT SHALL THE SPIDER'S PARLOR AND/OR ITS RESPECTIVE SUPPLIERS 
'    BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
'    DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
'    WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
'    ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
'    OF THIS CODE OR INFORMATION.
'
'==========================================================================

' Just replace the parent folder and file information below.
getDetails = GetFileDetails("C:\Program Files (x86)\Microsoft Office\Office12","Winword.exe")



Function GetFileDetails(folderName,fileName)
        On Error Resume Next
        Dim objShell
        Dim objFolder
        Dim HeaderInfoArray(34)
        
        Set objShell = CreateObject("Shell.Application")
        Set objFolder = objShell.NameSpace(folderName)

        If (not objFolder is nothing) Then
        	For i = 0 to 34    
        		HeaderInfoArray(i) = objFolder.GetDetailsOf(objFolder.Items, i)
        	Next
            Dim objFolderItem

            Set objFolderItem = objFolder.ParseName(fileName)

            If (not objFolderItem Is Nothing) then
                Dim objInfo
                For i = 0 To 34        
                	objInfo = objFolder.GetDetailsOf(objFolderItem, i)
                	WScript.Echo i,Space(3-Len(i)),HeaderInfoArray(i) & ":", _ 
                    Space(16-Len(HeaderInfoArray(i))),objInfo
                Next
            End If
            
            Set objFolderItem = Nothing
        End If
        
        Set objFolder = Nothing
        Set objShell = Nothing
End Function

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top