Is file version info obtainable via batch

D

djc

using batch files is often cleaner and simpler than using VB with WSH. For a
task I am currently doing I need to programatically obtain the file version
of a dll file. In WSH this is done via the file system object's
GetFileVersion() method. This version is only on dll and other executibles.
For example is can be somthing like 1.08.234. Can I get this attribute from
the command prompt? If so my script could be much simpler.

thanks
 
M

Matthias Tacke

djc said:
using batch files is often cleaner and simpler than using VB with WSH. For a
task I am currently doing I need to programatically obtain the file version
of a dll file. In WSH this is done via the file system object's
GetFileVersion() method. This version is only on dll and other executibles.
For example is can be somthing like 1.08.234. Can I get this attribute from
the command prompt? If so my script could be much simpler.

thanks
In the w2k reskit there is a filever.exe. You may download it here:
URL: http://www.dynawell.com/reskit/microsoft/win2000/filever.zip

Sample output on itself once complete and once filtered to the version:

==screen-copy=========================================================
C:\test>filever x:filever.exe /B
--a-- W32i APP ENU 5.0.2134.1 shp 13,584 11-30-1999 x:\filever.exe

C:\test>for /F "tokens=5" %A in ('filever x:filever.exe') do @echo/%A
5.0.2134.1

C:\test>
==screen-copy=========================================================

HTH
 
D

djc

I like. Thanks!

Matthias Tacke said:
In the w2k reskit there is a filever.exe. You may download it here:
URL: http://www.dynawell.com/reskit/microsoft/win2000/filever.zip

Sample output on itself once complete and once filtered to the version:

==screen-copy=========================================================
C:\test>filever x:filever.exe /B
--a-- W32i APP ENU 5.0.2134.1 shp 13,584 11-30-1999 x:\filever.exe

C:\test>for /F "tokens=5" %A in ('filever x:filever.exe') do @echo/%A
5.0.2134.1

C:\test>
==screen-copy=========================================================

HTH

--
Greetings
Matthias________________________________________
For help on nt commands enter in a cmd window:
W2K>HH windows.chm::ntcmds.htm XP>HH ntcmds.chm
 
D

djc

yep, I'm aware of that and assumed most here would know that as well. I'll
be more specific in the future.
thanks.
 
A

Al Dunbar [MS-MVP]

djc said:
yep, I'm aware of that and assumed most here would know that as well. I'll
be more specific in the future.
thanks.

The regulars certainly know. But we get a lot of first-timers here looking
for solutions, and we don't want to confuse them about such details.

/Al
 
D

djc

do you know if this version of filever would work under nt4 as well? and XP?
I support a mix of NT4/2K/XP workstations so I tend to stay away from
anything unless it works on all 3. If you know let me know. I'll just try it
if I don't here from you.

thanks agian.
 
M

Matthias Tacke

djc said:
do you know if this version of filever would work under nt4 as well? and XP?
I support a mix of NT4/2K/XP workstations so I tend to stay away from
anything unless it works on all 3. If you know let me know. I'll just try it
if I don't here from you.

thanks agian.

XP is no problem and nt4 should works also, but testing would take more
time.

HTH
 
B

Bill Stewart

djc said:
using batch files is often cleaner and simpler than using VB with WSH.
For a task I am currently doing I need to programatically obtain the file
version of a dll file. In WSH this is done via the file system object's
GetFileVersion() method. This version is only on dll and other
executibles. For example is can be somthing like 1.08.234. Can I get this
attribute from the command prompt? If so my script could be much simpler.

Hi djc,

I also wrote a freeware program called fver.exe that lets you check a
file's version in ERRORLEVEL from a batch file.

http://home.comcast.net/~stewartb/wast.html

HTH,

Bill
 
D

djc

thanks agian.

Matthias Tacke said:
XP is no problem and nt4 should works also, but testing would take more
time.

HTH
--
Greetings
Matthias________________________________________
For help on nt commands enter in a cmd window:
W2K>HH windows.chm::ntcmds.htm XP>HH ntcmds.chm
 
D

David Wang [Msft]

Filever uses the following Win32 API calls to retrieve this information:
VerQueryValue
GetFileVersionInfo
GetFileVersionInfoSize

which works from Windows 95 and Windows NT 3.1 and up.

--
//David
IIS
This posting is provided "AS IS" with no warranties, and confers no rights.
//
just FYI. I'm confirming here that it worked fine for me under NT SP6.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top