ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[¤À¨É] DOS¥HBATÀÉ«ü¥O¥h§PÂ_§@·~¨t²Î

[¤À¨É] DOS¥HBATÀÉ«ü¥O¥h§PÂ_§@·~¨t²Î

DOS¥HBATÀÉ«ü¥O¥h§PÂ_§@·~¨t²Î

if "%OS%" == "Windows_NT"
OS¬°Windows NT /2000/ XP
¤£µM«h¬° Windows 95/98/Me


%WinDir%
C:\Windows (Windows 95/98/Me/XP)
C:\WINNT (Windows NT/2000)

----------------------------------------------------

if "%OS%" == "Windows_NT"
goto RunNT2kXP
else
goto RunWin9xMe

:RunNT2kXp
.......cmd......
goto end

:RunWin9xMe
.......cmd....
goto end

:end

----------------------------------------------------

@echo off
@rem OS.bat

@rem Windows 2000 (NT 5.0)
@rem Windows XP (NT 5.1)
@rem Windows 2003 (NT 5.2)
@rem Windows Vista/2008 (NT 6.0)
@rem Windows 7/2008 R2 (NT 6.1)

REM detect Windows NT vs. 9x
echo %OS%
if "%OS%" == "Windows_NT" goto NT
goto Unsupport

:NT
REM determine build of NT (if necessary)
for /f "delims=[] tokens=2 " %%i in ( 'ver ') do set MyVer=%%i
for /f "tokens=2 " %%i in ( 'echo %MyVer% ') do set MyVer=%%i
for /f "tokens=1,2,3 delims=. " %%i in ( 'echo %MyVer% ') do (
set MajorVer=%%i
set MinorVer=%%j
set BuildNum=%%k
)

echo MyVer = %MyVer%
echo MajorVer == %MajorVer%
echo MinorVer == %MinorVer%
echo BuildNum == %BuildNum%

if "%MajorVer%" == "5" goto NT5
if "%MajorVer%" == "6" goto NT6

:NT5

@echo NT5
if "%PROCESSOR_ARCHITECTURE%" == "x86" goto NT5x86
if "%PROCESSOR_ARCHITECTURE%" == "AMD64" goto NT5x64
goto UnSupport

:NT5x86

@echo Windows 2000/XP/2003 x86
@rem do something
goto OK

:NT5x64

@echo Windows 2000/XP/2003 x64
@rem do something
goto OK

:NT6

if "%SESSIONNAME%" == "Console" goto NoAdmin
if "%PROCESSOR_ARCHITECTURE%" == "x86" goto NT6x86
if "%PROCESSOR_ARCHITECTURE%" == "AMD64" goto NT6x64
goto UnSupport

:NT6x86

@echo Windows Vista/2008/7/2008 R2 x86
@rem do something
goto OK

:NT6x64

@echo Windows Vista/2008/7/2008 R2 x64
@rem do something
goto OK

:NoAdmin

@echo Please run "Command Prompt" as Administrator !
goto exit

:UnSupport

@echo OS is not supported !
goto exit

:OK

@rem do something

:exit

pause

ÁöµM¬O«Ü¤[ªº¸ê°T,¹ê¦b¬O¦³¥Î.
«O¯d¤@¤U. ÁÂÁÂ

TOP

        ÀR«ä¦Û¦b : ¬O«D·í±Ð¨|¡AÆg¬ü§@ĵ±§¡C
ªð¦^¦Cªí ¤W¤@¥DÃD