Detect Windows OS then execute an external BAT file, but failed

Found a BAT program online and I currently has 3 OSs {WINXP, 7 and 8.1} and want to check on the OS version and executed if it applied to the OS I have, but none are run.{ http://www.grimadmin.com/article.php/batchfile-easy-way-to-detect-os-version }

Thank you,

Lots of ways but you could try this one if you want:Steve

Lots of ways but you could try this one if you want:Steve

While there are more efficient ways to go about this, the code you are using should work. A couple of thoughts on that.

Is it displaying the "Machine undertermined" message? If not, what is happening?

Can you post up the output of the VER command on the system it fails on, as well as the SYSTEMINFO command (at least the "OS NAME" line.

I also noticed a potential problem in the following block:

Here is a slightly leaner version using a similar basic approach to what you were using, since you are only really interested in 3 versions. WMIC is a bit faster than using SYSTEMINFO also, since we can query just what we want.