Skip to content

Instantly share code, notes, and snippets.

@ma34s
Last active December 11, 2015 10:08
Show Gist options
  • Save ma34s/4584833 to your computer and use it in GitHub Desktop.
Save ma34s/4584833 to your computer and use it in GitHub Desktop.
windowsの各Ver毎に処理を分けるバッチ
@echo off
for /f "delims=" %%i in ('ver') do set _VER=%%i
set win_version=%_VER:~-9,3%
if "%win_version%"=="6.2" goto win_8
if "%win_version%"=="6.1" goto win_7
if "%win_version%"=="6.0" goto win_vista
if "%win_version%"=="5.2" goto win_2003
if "%win_version%"=="5.1" goto win_xp
if "%win_version%"=="5.0" goto windows2000
if "%win_version%"=="4.0" goto win_nt4
if "%win_version%"=="3.1" goto win_nt31
if "%win_version%"=="3.5" goto win_nt35
if "%win_version%"=="3.51" goto win_nt351
if "%win_version%"=="4.90" goto win_me
if "%win_version%"=="4.10" goto win_98
:win_8
echo windows8 or Windows Server 2012
goto xxx_proc
:win_7
echo windows7 or Windows Server 2008 R2 or Windows Home Server 2011
goto xxx_proc
:win_vista
echo windows vista or Windows Server 2008
goto xxx_proc
:win_xp
echo windows xp
goto xxx_proc
:win_2003
echo windows 2003 server or xp(64bit) or home server
goto xxx_proc
:win_2000
echo windows2000
goto xxx_proc
:win_me
echo windows me
goto xxx_proc
:win_98
echo windows 98
goto xxx_proc
:win_nt4
echo windows NT4.0
goto xxx_proc
:win_nt31
echo windows NT3.1
goto xxx_proc
:win_nt35
echo windows NT3.5
goto xxx_proc
:win_nt351
echo windows NT3.51
goto xxx_proc
:xxx_proc
exit /b 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment