Batch Script Check File Version Dos

I'm trying to set the output of a commandline program to a variable in a Windows batch file. For example, if I'd like to read the output of the 'ver' command (which tells you what version of window) t. Jul 12, 2015. The following is a batch script (save as *.bat or *.cmd) that can almost run on every Windows Version and the output will be a string that indicates which Win ver you are running on. The principle is to check the version from command “ver” and use “find” to find specific version numbers. Use errorlevel to. Batch file: Check if OS is Windows 10. (the,version ensures, your desired string is not the last token, which contains that ugly wmic line ending).
I have two executables (file1.exe and file2.exe).
Both are the 'same' file, but one is a newer version from the vendor than the other. When I open up the properties for one of them, I get the following under the Details tab:
In batch, I'd like to compare the two file versions and do something if the versions are different ('if this, then that' type of scenario).
Batch Script Check File Version Dose
I've searched high and low, but I can't seem to find a method of looking at the 'File Version' attribute in batch. Is there any means of accomplishing this?
Please note that this is not intended to be a 'write a script for me' question. The intent is for a more general overview or description of the answer, at which point, the details should be able to come much more easily.
Panzercrisis
3 Answers
- if need add MD5, SHA1, PESHA1, SHA256
- test version, and run command:
Windows XP Service Pack 2 Support Tools or
var 2:
FileDescription:
version:
script version compare:
output:
vers01.vbs:
vers01.js:
pefile modyle install: Unzip, run python setup.py install
php.ini (%windir%):
vers01.php:
Install Win32::File::VersionInfo module: cpan Win32::File::VersionInfo

@STTR' answer is fine, except it does not provide a way to namely compare versions in batch, as this may be also the problem, for example, when comparing 10.0.10049 with 6.3.9600.
If you'll do it with plain IF %ver1% GTR %ver%, you'll get string comparison, and 6.3.9600 will appear bigger than 10.0.10049.
Dos Batch File Examples
I know you've told it's not 'write for me', but this is case when it's easier to write code than explain in plain English (and the code is self-explanatory).
From https://superuser.com/a/363308/131936 I've found how to read file version using wmic, which is shipped with bare windows.
first, read one file version:
then compare it with other file(s):
also, you can hardcode version, if you want:
P.S. Here is my script to read/check windows version, built on similar principle.
Dos Batch File
LogicDaemonNot exactly for version checking, but you can calculate and compare the MD5 or SHA1 checksum of two files and then compare if they're the same. If the checksum strings are equal, the two files are exactly same (hence the same version), else different.
You can use the FCIV tool in command line to calculate checksum.
Not the answer you're looking for? Browse other questions tagged batchfile-attributes or ask your own question.
echo %FOO%IF NOT DEFINED FOO SET FOO='bar'. Useful for testing command line arguments.IF ERRORLEVEL $n $CMD-TO-EXECUTE. It executes the command if result code is equal or greater to $n, so to check for any failures use 1.FOR /L %%A IN (1,1,10) DO @echo helloIF EXIST e:directory GOTO USE_EShare on