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 > .bat to detect operating system
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
.bat to detect operating system

Réponse
 
LinkBack Outils de la discussion
Vieux 04/09/2008, 00h46   #1
David Lewis
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut .bat to detect operating system

We are currently using .bat files for our login scripts
Yaya I know so 1998
Anyways until we can switch to .vbs or anything else
I need to put some code in the .bat login script to not run if it's a
windows 2003 server
The IT guys still need login scripts but I don't want them running on the
servers.


--
David Lewis
Information Technology Manager
Cubellis

  Réponse avec citation
Vieux 04/09/2008, 02h05   #2
Michael Bednarek
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: .bat to detect operating system

On Wed, 3 Sep 2008 15:46:47 -0700, "David Lewis" <*@*.*> wrote in
microsoft.public.windows.server.scripting:

>We are currently using .bat files for our login scripts
>Yaya I know so 1998
>Anyways until we can switch to .vbs or anything else
>I need to put some code in the .bat login script to not run if it's a
>windows 2003 server
>The IT guys still need login scripts but I don't want them running on the
>servers.


Parse the output of the command: VER.

--
Michael Bednarek http://mbednarek.com/ "POST NO BILLS"
  Réponse avec citation
Vieux 04/09/2008, 13h49   #3
Dave R.
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: .bat to detect operating system


"David Lewis" <*@*.*> wrote in message
news:%230GP1bhDJHA.3392@TK2MSFTNGP03.phx.gbl...
> We are currently using .bat files for our login scripts
> Yaya I know so 1998
> Anyways until we can switch to .vbs or anything else
> I need to put some code in the .bat login script to not run if it's a
> windows 2003 server
> The IT guys still need login scripts but I don't want them running on
> the servers.
>


This is covered extensively in Timo Salmi's most excelent CMD.EXE
scripting FAQ: See http://www.netikka.net/tsneti/info/tscmd004.htm

Hope that s!

Dave


  Réponse avec citation
Vieux 10/10/2008, 07h52   #4
FileGod
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: .bat to detect operating system

"David Lewis" <*@*.*> wrote:
>We are currently using .bat files for our login scripts Yaya I know so

1998mAnyways until we
>can switch to .vbs or anything elseuI need to put some code in the .bat

login script to not run
>if it's a Awindows 2003 server<The IT guys still need login scripts but I

don't want them
>running on the 8servers.oft-- mDavid LewisJInformation Technology

Manager<Cubellis

This should you, Win 98 echo %os% would not work but ver works, I found
this on the web:
@ECHO OFF

:: Win9x checks ::::::::::::

VER |find /i "Windows 95" >NUL
IF NOT ERRORLEVEL 1 GOTO W9598ME

VER |find /i "Windows 98" >NUL
IF NOT ERRORLEVEL 1 GOTO W9598ME

VER |find /i "Windows Millennium" >NUL
IF NOT ERRORLEVEL 1 GOTO W9598ME

:: NT/XP checks ::::::::::::
VER | find "XP" > nul
IF %errorlevel% EQU 0 GOTO s_win_XP

VER | find "2000" > nul
IF %errorlevel% EQU 0 GOTO s_win_2000

VER | find "NT" > nul
IF %errorlevel% EQU 0 GOTO s_win_NT

ECHO Unknown OS !
GOTO :EOF

:: Win9x commands ::::::::::::

:W9598ME
ECHO Win9x commands go here
GOTO :EOF

:W98
ECHO Win98 commands go here
GOTO :EOF

:: NT/XP commands ::::::::::::

:s_win_XP
ECHO XP commands go here
goto :eof

:s_win_2000
ECHO WIN2K commands go here
goto :eof

:s_win_NT
ECHO NT4 commands go here
goto :eof

:EOF (End-of-file)Service Pack Version

rem I found this here:
rem http://www.fortypoundhead.com/showcontent.asp?ArtID=837

Have a good one!
http:/www.filegod.netfirms.com

  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 02h45.


Édité par : vBulletin® version 3.7.4
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,10861 seconds with 12 queries