Solved Getting Operating Version Basic Details

December 8, 2011 at 08:25:50
Specs: Windows XP SP3, 4000+ / 2gb DDR
Batch OS Get Version

I thought I'd got this working, until a friend tested it on windows 7,
as it turned out by filtering after Bracket: [

I was left with only "Microsoft Windows" being displayed on a none
XP machine.

As she use's Windows 7, how can I make this work and only fetch
the 3rd digit from the output which is what we get with no filtering
from such as:

Microsoft Windows [Version 6.1.7601]

I am stumped, basically want to be able to do a verify of compatible
OS before my batch CALLS secondary batch files for different OS
each customised for that other OS.

I have no idea about Vista yet as not had access to my daughters
Vista PC yet.
:: CODE I HAVE SO FAR BELOW

@echo off
setLocal EnableDelayedExpansion
for /f "tokens=1* delims=*[" %%j in ('ver') do set myOS=%%j

echo ------------------------------------------------------------
echo This is the Version of MS Windows
echo which is Installed on this computer!
echo ++++++++++++++++++++
echo %myOS%
echo ++++++++++++++++++++
echo A text file containing this information
echo should now be on your desktop.
echo ------------------------------------------------------------
echo.
>> "C:\%HOMEPATH%\DESKTOP\My_Version.txt" echo %myOS%
if "%myOS%"=="Microsoft Windows XP " echo Verified: Microsoft Windows XP &&goto XP
if "%myOS%"=="Microsoft Windows Vista " echo Verified: Microsoft Windows Vista &&goto vista
if "%myOS%"=="Microsoft Windows 7 " echo Verified: Microsoft Windows 7 &&goto win7
goto done

:: COMMANDS BELOW SUBSTITUTED BY ECHO FOR SAFETY.

:XP
echo.
echo You Have Windows XP Installed &&goto done

:vista
echo.
echo You Have Windows vista Installed &&goto done

:win7
echo.
echo You Have Windows 7 Installed &&goto done

:done
echo.
pause
endlocal
exit


See More: Getting Operating Version Basic Details

Report •

#1
December 8, 2011 at 11:18:51
✔ Best Answer
I think you'll find a workable solution here

http://www.grimadmin.com/article.ph...


Report •

#2
December 8, 2011 at 12:31:38
Thanks viddywell I will try it :D

Report •

#3
December 8, 2011 at 14:20:50
I have tried the first block of code on that site, the part I want is the basic Windows xp or windows 7 etc, am a little concerned by some feedback though as a user said it didn't work so will need to have more people test it for me, I have windows 2000 here and XP, my daughter has windows vista (NOT TESTED), and my friend just tested it on window 7 so (that works).

Would be nice to have it more condensed though is quite bulky.

Michelle xxx


Report •
Related Solutions


Ask Question