|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi,
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. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
"DPM" <aa@bb.cc> wrote in message 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 ? Since Vista is currently the most recently release version of windows, what othre versions are you thinking of as being higher than that? > 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 ? If you are running your batch file on some version of windows higher than 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 > OS is Vista and above ? > (FIND only searches for a perticular text) One way would be to determine all of the possible values produced by the ver 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 |
|
![]() |
| Outils de la discussion | |
|
|