PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > ms.win.server.scripting > How to identify if the OS is Vista or higher
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
How to identify if the OS is Vista or higher

Réponse
 
LinkBack Outils de la discussion
Vieux 23/11/2007, 14h14   #1
DPM
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut How to identify if the OS is Vista or higher

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.



  Réponse avec citation
Vieux 24/11/2007, 03h05   #2
Al Dunbar
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to identify if the OS is Vista or higher


"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


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 10h16.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12984 seconds with 10 queries