|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to identify if the OS is Vista or higher
Is there a way to know if the OS version is Vista or higher through a MS-DOS batch file ? Following is a sample which I managed to do Ver > OSVer.Txt FIND "[Version 6." OSVer.Txt > NUL IF ERRORLEVEL 1 ECHO OS is not Vista IF NOT ERRORLEVEL 1 ECHO OS is Vista The problems which I have regarding the above are, - How to get the output from the VER command to a variable ? or is there any other command ? - Say if I send the output from VER to a text file how to know whether the OS is Vista and above ? (FIND only searches for a perticular text) Please advise. "DPM" <a*@bb.cc> wrote in message Since Vista is currently the most recently release version of windows, what news:eqNzIwdLIHA.4684@TK2MSFTNGP06.phx.gbl... > Hi, > > Is there a way to know if the OS version is Vista or higher through a > MS-DOS > batch > file ? othre versions are you thinking of as being higher than that? > Following is a sample which I managed to do If you are running your batch file on some version of windows higher than > > Ver > OSVer.Txt > FIND "[Version 6." OSVer.Txt > NUL > IF ERRORLEVEL 1 ECHO OS is not Vista > IF NOT ERRORLEVEL 1 ECHO OS is Vista > > The problems which I have regarding the above are, > - How to get the output from the VER command to a variable ? or is there > any > other command ? MS-DOS, you could try this: for /f "tokens=*" %%F in ('ver') do set _ver=%%F > - Say if I send the output from VER to a text file how to know whether the One way would be to determine all of the possible values produced by the ver > OS is Vista and above ? > (FIND only searches for a perticular text) command and test each one, i.e.: for /f "tokens=*" %%F in ('ver') do set _ver=%%F if /i "%_ver%" EQU "Microsoft Windows XP [Version 5.1.2600]" set _OS=XP if /i "%_ver%" EQU "Microsoft Windows Vista [Version 6.whatever it is]" set _OS=WV and etc. /Al |
|||||||||||||||||||||||