A Windows XP help forum. PCbanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » PCbanter forum » Microsoft Windows 7 » Windows 7 Forum
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Windows program version from the command line?



 
 
Thread Tools Rate Thread Display Modes
  #1  
Old December 20th 14, 03:40 AM posted to alt.windows7.general
Todd[_5_]
external usenet poster
 
Posts: 724
Default Windows program version from the command line?

Any of you guys know how to read the version of a Windows program
from the command line? (The same version you get from Windows
Explorer by right clicking on the program and selecting properties.)
Ads
  #2  
Old December 20th 14, 04:06 AM posted to alt.windows7.general
Paul in Houston TX
external usenet poster
 
Posts: 744
Default Windows program version from the command line?

Todd wrote:
Any of you guys know how to read the version of a Windows program
from the command line? (The same version you get from Windows
Explorer by right clicking on the program and selecting properties.)


ver
  #3  
Old December 20th 14, 04:32 AM posted to alt.windows7.general
Todd[_5_]
external usenet poster
 
Posts: 724
Default Windows program version from the command line?

On 12/19/2014 08:06 PM, Paul in Houston TX wrote:
Todd wrote:
Any of you guys know how to read the version of a Windows program
from the command line? (The same version you get from Windows
Explorer by right clicking on the program and selecting properties.)


ver



$ ver privatefirewall-7.0.30.3.exe
Microsoft Windows XP [Version 5.1.2600]

Huh. "ver" is giving me the version of Windows, not
the program. Rats!
  #4  
Old December 20th 14, 05:46 AM posted to alt.windows7.general
Gavon[_2_]
external usenet poster
 
Posts: 2
Default Windows program version from the command line?

On 20-December-2014 1:40 PM, Todd wrote:
Any of you guys know how to read the version of a Windows program
from the command line? (The same version you get from Windows
Explorer by right clicking on the program and selecting properties.)



winver
  #5  
Old December 20th 14, 05:56 AM posted to alt.windows7.general
Todd[_5_]
external usenet poster
 
Posts: 724
Default Windows program version from the command line?

On 12/19/2014 09:46 PM, Gavon wrote:
On 20-December-2014 1:40 PM, Todd wrote:
Any of you guys know how to read the version of a Windows program
from the command line? (The same version you get from Windows
Explorer by right clicking on the program and selecting properties.)



winver



Hi Gavon,

On mine, that pops up a pretty graphic of the Windows
version. I am looking for a program's version.
The one you get when you use Windows Explorer and
right click, properties on the exe's file name.

-T

  #6  
Old December 20th 14, 06:13 AM posted to alt.windows7.general
Gavon[_2_]
external usenet poster
 
Posts: 2
Default Windows program version from the command line?

On 20-December-2014 3:56 PM, Todd wrote:
On 12/19/2014 09:46 PM, Gavon wrote:
On 20-December-2014 1:40 PM, Todd wrote:
Any of you guys know how to read the version of a Windows program
from the command line? (The same version you get from Windows
Explorer by right clicking on the program and selecting properties.)



winver



Hi Gavon,

On mine, that pops up a pretty graphic of the Windows
version. I am looking for a program's version.
The one you get when you use Windows Explorer and
right click, properties on the exe's file name.

-T


So you need to get the version of a particular .exe file while in a DOS
window ??
  #7  
Old December 20th 14, 06:59 AM posted to alt.windows7.general
Todd[_5_]
external usenet poster
 
Posts: 724
Default Windows program version from the command line?

On 12/19/2014 10:13 PM, Gavon wrote:
On 20-December-2014 3:56 PM, Todd wrote:
On 12/19/2014 09:46 PM, Gavon wrote:
On 20-December-2014 1:40 PM, Todd wrote:
Any of you guys know how to read the version of a Windows program
from the command line? (The same version you get from Windows
Explorer by right clicking on the program and selecting properties.)


winver



Hi Gavon,

On mine, that pops up a pretty graphic of the Windows
version. I am looking for a program's version.
The one you get when you use Windows Explorer and
right click, properties on the exe's file name.

-T


So you need to get the version of a particular .exe file while in a DOS
window ??


Yes

  #8  
Old December 20th 14, 07:44 AM posted to alt.windows7.general
Paul in Houston TX
external usenet poster
 
Posts: 744
Default Windows program version from the command line?

Todd wrote:
On 12/19/2014 08:06 PM, Paul in Houston TX wrote:
Todd wrote:
Any of you guys know how to read the version of a Windows program
from the command line? (The same version you get from Windows
Explorer by right clicking on the program and selecting properties.)


ver



$ ver privatefirewall-7.0.30.3.exe
Microsoft Windows XP [Version 5.1.2600]

Huh. "ver" is giving me the version of Windows, not
the program. Rats!


Ah... sorry, thought you meant Windows itself.
  #9  
Old December 20th 14, 07:50 AM posted to alt.windows7.general
Todd[_5_]
external usenet poster
 
Posts: 724
Default Windows program version from the command line?

On 12/19/2014 11:44 PM, Paul in Houston TX wrote:
Todd wrote:
On 12/19/2014 08:06 PM, Paul in Houston TX wrote:
Todd wrote:
Any of you guys know how to read the version of a Windows program
from the command line? (The same version you get from Windows
Explorer by right clicking on the program and selecting properties.)

ver



$ ver privatefirewall-7.0.30.3.exe
Microsoft Windows XP [Version 5.1.2600]

Huh. "ver" is giving me the version of Windows, not
the program. Rats!


Ah... sorry, thought you meant Windows itself.



No problem. I think it was an easy mistake to make.
  #10  
Old December 20th 14, 11:13 AM posted to alt.windows7.general
Paul
external usenet poster
 
Posts: 18,275
Default Windows program version from the command line?

Todd wrote:
Any of you guys know how to read the version of a Windows program
from the command line? (The same version you get from Windows
Explorer by right clicking on the program and selecting properties.)


I approached the problem this way.

First, find an article that talks about the data structure
in the header of executable files.

http://www.delphidabbler.com/articles?article=20

Then, take one of the parameters, combine it with
"vbscript", and see if anyone has written a script for it.

dwFileVersionMS vbscript

That gets me to a page like this.

http://stackoverflow.com/questions/6...ws-dll-version

OK, another.

http://stackoverflow.com/questions/3...-in-powershell

For some reason, not all of those commands in Powershell,
produce output here.

This would have been ideal, except you have to register
to get the download. Showver.exe.

http://www.codeproject.com/Articles/...-display-progr

HTH,
Paul
  #11  
Old December 20th 14, 12:39 PM posted to alt.windows7.general
Joe Morris
external usenet poster
 
Posts: 289
Default Windows program version from the command line?

"Todd" wrote in message
...

Any of you guys know how to read the version of a Windows program
from the command line? (The same version you get from Windows
Explorer by right clicking on the program and selecting properties.)


Do it in PowerShell:

get-itemproperty -path c:\foobar.exe | format-list -property
versioninfo

Joe


  #12  
Old December 20th 14, 01:19 PM posted to alt.windows7.general
Paul
external usenet poster
 
Posts: 18,275
Default Windows program version from the command line?

Joe Morris wrote:
"Todd" wrote in message
...

Any of you guys know how to read the version of a Windows program
from the command line? (The same version you get from Windows
Explorer by right clicking on the program and selecting properties.)


Do it in PowerShell:

get-itemproperty -path c:\foobar.exe | format-list -property
versioninfo

Joe



OK, I got this one to work, in Powershell.

[System.Diagnostics.FileVersionInfo]::GetVersionInfo("C:\Windows\notepad.exe") | format-list

Paul

  #13  
Old December 20th 14, 02:44 PM posted to alt.windows7.general
Mayayana
external usenet poster
 
Posts: 6,438
Default Windows program version from the command line?


| This would have been ideal, except you have to register
| to get the download. Showver.exe.
|
|
http://www.codeproject.com/Articles/...-display-progr
|

I've written a script to do that:

http://www.jsware.net/jsware/scrfiles.php5#fvinfo

The script provided is a demo of a VBScript
class that uses binary operations through
FileSystemObject to extract and parse the
VersionInfo section of PE files. PE files (portable
executable, such as EXE, DLL, OCX) are structured
in a complex design that involves a kind of index
at the beginning of the file, which contains data
about the offest into the file of various sections
that can be in a PE file, such as executable data,
import table, export table, etc. VersionInfo is one
of those sections. The Win32 API includes functions
to get version info, but VBS can't call Win32 API
functions. By parsing the actual bytes of the file
that requirement is bypassed, allowing the script
to do what version.dll would have done.

(Due to limitations
with FileSystemObject functions, the script will
not work properly on systems with the language
set to a DBCS language - Chinese, Japanese, or
Korean, but it should work fine on any other
Windows computer from Win98 up.)

Another limitation: This script deals with
32-bit executables. I haven't tested it with 64-bit
executables. A 64-bit PE file may have a different
structure. It will definitely contain some differences.
For instance, the pointer data that indicates the
offset into the file of the VersionInfo section will
be 4 bytes in a 32-bit PE file, but 8 bytes in a
64-bit PE file. So the script may fail when trying to
extract VersionInfo from a 64-bit executable because
it's assuming a structure based on 4-byte-centric
data storage.

A bit of editing might be in order, depending on
what one actually wants. As written this script
shows a long list of file properties in a msgbox
window.

There's also a method that uses Shell.Application,
which involves getting a shell Folder object for
the folder containing a file and then calling the
GetDetailsOf method. But that method is not feasible
in a console window and it's convoluted to do in a
VBScript. Worse, the file properties returned in
GetDetailsOf have been changed with each Windows
version. Microsoft has all but broken the functionality
of the method.

I have to wonder why someone is trying to
find file versions in a console window... or why
someone is doing anything in a console window
at all that doesn't have to be done there. It seems
beyond absurd to me to type a long a command
line to run a script, with the path of the file in
question as a parameter, when one could simply
drop that file onto the script.


  #14  
Old December 20th 14, 03:58 PM posted to alt.windows7.general
Mayayana
external usenet poster
 
Posts: 6,438
Default Windows program version from the command line?

I realized I overlooked the simplest script approach:

Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
MsgBox FSO.GetFileVersion("C:\windows\notepad.exe")
Set FSO = Nothing

It won't return product version, but those are
usually the same thing. The PowerShell approach
looks like it makes much more sense for console,
though. That's what PS is designed for. VBS was
designed for Windows GUI.


  #15  
Old December 20th 14, 09:57 PM posted to alt.windows7.general
Todd[_5_]
external usenet poster
 
Posts: 724
Default Windows program version from the command line?

On 12/20/2014 05:19 AM, Paul wrote:
Joe Morris wrote:
"Todd" wrote in message
...

Any of you guys know how to read the version of a Windows program
from the command line? (The same version you get from Windows
Explorer by right clicking on the program and selecting properties.)


Do it in PowerShell:

get-itemproperty -path c:\foobar.exe | format-list -property
versioninfo

Joe


OK, I got this one to work, in Powershell.

[System.Diagnostics.FileVersionInfo]::GetVersionInfo("C:\Windows\notepad.exe")
| format-list

Paul


Thank you guys!
 




Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off






All times are GMT +1. The time now is 11:13 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 PCbanter.
The comments are property of their posters.