Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Use DOS from CMD prompt to show file version on WinXP PC  (Read 30433 times)

0 Members and 1 Guest are viewing this topic.

r0mad

    Topic Starter


    Greenhorn

    Use DOS from CMD prompt to show file version on WinXP PC
    « on: September 26, 2008, 01:49:19 PM »
    I am trying to display a file's name, last modified date, and file version from the command line.

    dir /q
    -returns owner information and includes file name and last modified date.

    now I only need a way to see the files version information

    any help is much appreciated

    TheShadow



      Hopeful
    • Retiree in Florida
    • Thanked: 13
      • Yes
      • The Doctor
    • Certifications: List
    • Computer: Specs
    • Experience: Guru
    • OS: Windows XP
    Re: Use DOS from CMD prompt to show file version on WinXP PC
    « Reply #1 on: September 28, 2008, 08:28:32 AM »
    Since you've not had any response to your post in two days, I just thought I'd stop by and say "HI".

    What kind of file are you wanting to see the Version on?
    A doc or txt file for instance won't usually have any Version.
    However a program file like say, "Ghost.exe" will have a version and it will be shown if you type,
    Ghost /ver
    at the command prompt of the folder containing the file.

    Maybe give more info on your needs and someone will come up with just what you need.

    Cheers Mate!
    The Shadow  8)
    Experience is truly the best teacher.
    Backup! Backup! Backup!  Ghost Rocks!

    r0mad

      Topic Starter


      Greenhorn

      Re: Use DOS from CMD prompt to show file version on WinXP PC
      « Reply #2 on: September 29, 2008, 08:28:20 AM »
      Good point Shadow

      I'm trying to get version information from a directory of .dll files.

      I tried the "filename /ver" at the command prompt for the home directory but get this message:
      'filename.dll' is not recognized as an internal or external command,
      operable program or batch file.

      I tried the same option on a .exe file and it executes the file.

      Do you have a toolkit or package installed that allows the /ver to work?

      Thanks!

      TheShadow



        Hopeful
      • Retiree in Florida
      • Thanked: 13
        • Yes
        • The Doctor
      • Certifications: List
      • Computer: Specs
      • Experience: Guru
      • OS: Windows XP
      Re: Use DOS from CMD prompt to show file version on WinXP PC
      « Reply #3 on: September 29, 2008, 09:01:26 AM »
      If I'm wrong, I'll be the first one to admit it.... (Really!)
      But I think you're looking for something that does not exist.

      I don't understand why or even how there could be a Version assigned to a Folder.
      The date it was created, yes.  Windows Explorer will show you that.
      "That does not Compute!"  to quote "The Robot" from Lost in Space. ;) :D :D

      The fact that a program like, say, Ghost.exe can provide you with a version is actually written into the program itself.  It's NOT a function of DOS or Windows.
      When I actually do that with Ghost.exe (as an example), from a command prompt, I get all the Copyright info, the date the program was created and of course, the Version number.

      But if that ability was not actually written into the program itself, I'd get some kind of error by trying to run the program with the /ver extension.

      Just for grins and giggles, I just did this from my ghost folder:
      Ghost /ver > C:\Ghostver.txt

      And the resultant text file shows this:

      Symantec Ghost 8.3.0 (build=1331, cdrlib=3.1.31). Built on Nov 28 2005 17:37:37.
      Copyright (C) 1998-2005 Symantec Corporation. All rights reserved.


      But, the ability to divulge that information had to be written into the file itself.

      Am I making any sense at all here?

      Ok, I'll shut up now.

      Y'all have a great day now, Y'hear?

      The Shadow  8)




      Experience is truly the best teacher.
      Backup! Backup! Backup!  Ghost Rocks!

      BC_Programmer


        Mastermind
      • Typing is no substitute for thinking.
      • Thanked: 845
        • Yes
        • Yes
        • BC-Programming.com
      • Certifications: List
      • Computer: Specs
      • Experience: Beginner
      • OS: Windows 7
      Re: Use DOS from CMD prompt to show file version on WinXP PC
      « Reply #4 on: September 29, 2008, 09:26:55 AM »
      If I read his clarification correctly- I can surmise he wants the version number of the DLL files, not the folder itself.

      I've seen command-line programs for this, but I completely forgot where... (helpful, I know)
      I was trying to dereference Null Pointers before it was cool.

      r0mad

        Topic Starter


        Greenhorn

        Re: Use DOS from CMD prompt to show file version on WinXP PC
        « Reply #5 on: September 29, 2008, 10:27:07 AM »
        BC:  That's correct, I'm trying to get the version information from the .dll files. 

        From the XP GUI I can show the versions but wanted to use DOS to pipe them to a flat file.

        Shadow:  Thanks for the effort!  Just curious, does the /ver switch work on other .exe files other than Ghost?  I'm also starting to think that this option doesnt exist for DOS.  Maybe an approach from ASP.... I have over 10,000 files to get version info from so trying to do this programatically.

        Sidewinder



          Guru

          Thanked: 121
        • Experience: Familiar
        • OS: Windows 7
        Re: Use DOS from CMD prompt to show file version on WinXP PC
        « Reply #6 on: September 29, 2008, 11:26:45 AM »
        Quote
        Maybe an approach from ASP.... I have over 10,000 files to get version info from so trying to do this programatically

        If you would like to do this with VBScript, this may help you out:

        Code: [Select]
        Set fso = CreateObject("Scripting.FileSystemObject")
        Set objShell = CreateObject("Shell.Application")
        Set f = fso.GetFolder("c:\windows\system32")          'change directory name
        Set fc = f.Files
        For Each fs In fc
        If fso.GetExtensionName(fs) = "dll" then
        WScript.Echo fs.Name, fs.DateLastModified, fso.GetFileVersion(fs)
        End if
        Next

        Save script with a vbs extension and run from the command line as cscript scriptname.vbs

         8)

        You may want to make the output more presentable.
        It has been my experience that folks who have no vices have very few virtues

        - Abraham Lincoln

        BC_Programmer


          Mastermind
        • Typing is no substitute for thinking.
        • Thanked: 845
          • Yes
          • Yes
          • BC-Programming.com
        • Certifications: List
        • Computer: Specs
        • Experience: Beginner
        • OS: Windows 7
        Re: Use DOS from CMD prompt to show file version on WinXP PC
        « Reply #7 on: September 29, 2008, 11:44:13 AM »
        OMG... and to think I was just reading up on the WIndows FileVersion API functions and write a C Program for essentially that purpose.

        You saved me a lot of work Sidewinder! :)
        I was trying to dereference Null Pointers before it was cool.

        r0mad

          Topic Starter


          Greenhorn

          Re: Use DOS from CMD prompt to show file version on WinXP PC
          « Reply #8 on: September 29, 2008, 02:50:28 PM »
          Sidewinder:  Thanks for the help, that was exactly what I needed!  I modifed the file like below to get a flat file output.

          Worked Great!


          Code: [Select]
          Option Explicit
          Dim fso, fc, f, fs 
          Dim strPath, strFile

          'On Error Resume Next

          strPath = "C:\Documents and Settings\profile\desktop\dlls.txt"

          Set fso = CreateObject("Scripting.FileSystemObject")

          Set strFile = fso.CreateTextFile(strPath, True)

          strFile.WriteLine("FileName,Last Modified,File Version")

          Set f = fso.GetFolder("C:\Documents and Settings\profile\dlldir")         
          Set fc = f.Files
          For Each fs In fc
          If fso.GetExtensionName(fs) = "dll" then
          strFile.WriteLine(fs.Name & "," & fs.DateLastModified & "," & fso.GetFileVersion(fs))
          End if
          Next