Most Batch files for detecting Windows versions try to parse the either the [WayBack] output fromVER
or the [WayBack] output from SYSTEMINFO
[WayBack], but forget that there many Windows installations are not English. Some even use WMIC, but [WayBack] WMIC is only available for administrators and not available some flavours like XP Home.
Languages issues are always important to watch for. The Dutch Windows XP returns Microsoft Windows XP [versie 5.1.2600] which is just one word different from the English Microsoft Windows XP [Version 5.1.2600]. Other languages may differ even more.
This batch file tries to circumvent the language differences, uses VER
and works at least with Dutch and English Windows versions of XP and 7, most likely with many other languages and versions as well.
On a Windows XP SP3 machine, it lists WindowsVersion=5.1.2600
and on a Windows 7 SP1 machine it lists WindowsVersion=6.1.7601
.
One possible addition would be to [WayBack] detect x64 or x86.
The detection assumes that VER will emit the version in [angle] brackets, and uses two batch file for loops to get the text in between them using the [WayBack] tokens and delims for loop parameters in the first for loop right behind the begin label and the second for loop right after the parse1 label.
Then it splits the remaining text using spaces at the parse2 label, and takes the right most portion using the [WayBack] shift command at the parse3 label.
Many thanks to [WayBack] Rob van der Woude for a lot of interesting batch file documentation. Read the rest of this entry »