System Administration Scripting

2007年3月27日星期二

测试Windows版本的批处理

@echo off

ver | find "2003" > nul
if %ERRORLEVEL% == 0 goto v2003

ver | find "XP" > nul
if %ERRORLEVEL% == 0 goto vxp

ver | find "2000" > nul
if %ERRORLEVEL% == 0 goto v2000

ver | find "NT" > nul
if %ERRORLEVEL% == 0 goto vnt

echo Unknow OS Version.
goto exit

:v2003
:Run Windows 2003 specific commands here.
echo Windows Server 2003
goto exit

:vxp
:Run Windows XP specific commands here.
echo Windows XP
goto exit

:v2000
:Run Windows 2000 specific commands here.
echo Windows 2000
goto exit

:vnt
:Run Windows NT-specific commands here.
echo Windows NT
goto exit

:exit

Bookmark this post:
Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google


0 评论:

相关文章

©2007