@Echo Off
:: BEGIN CALLOUT A
If Windows_NT == %OS% Goto WINNT
Echo You are not running Windows NT (Windows 95/98/ME perhaps?)
Goto END
:: END CALLOUT A
:WINNT
:: BEGIN COMMENT
:: Check for Windows 2003.
:: END COMMENT
For /f «tokens=4» %%i in (?ver?) Do Set osver=%%i
If %osver%==5.2.3790] Goto WINDOWS2003 
:: BEGIN COMMENT
:: Check for XP.
:: END COMMENT
For /f «tokens=3» %%i in (?ver?) Do Set osver=%%i
If %osver%==XP Echo Goto XP
:: BEGIN CALLOUT B
:: BEGIN COMMENT
:: Check to see whether the GetType file exists. If not, 
:: go to FILENOTFOUND.
:: END COMMENT
If Not Exist %systemdrive%gettype.exe Goto FILENOTFOUND
:: END CALLOUT B
:: BEGIN CALLOUT C
:: BEGIN COMMENT
:: Execute GetType.exe to check for OS type (Win2K or NT) 
:: and role (DC or non-DC).
:: END COMMENT
GetType.exe
:: END CALLOUT C
:: BEGIN COMMENT
:: Call the script for the environment according to the error level.
? END COMMENT
If ERRORLEVEL=2 Goto TWO
If ERRORLEVEL=1 Goto ONE
:FILENOTFOUND
Echo.
Echo Gettype.exe file not found.
Echo.
Goto END
:TWO
Echo Windows 2000 Professional
%systemdrive%Windows2000install.vbs
Goto END
:ONE
Echo Windows NT Workstation
%systemdrive%WindowsNTinstall.vbs
Goto END
:XP
Echo Windows XP
%systemdrive%WindowsXPinstall.vbs
Goto END
:WINDOWS2003
Goto END
:END
Exit

Поделитесь материалом с коллегами и друзьями