-
-
Save ir-norn/ede1d6cfbd5ec37c481584277273f001 to your computer and use it in GitHub Desktop.
this is os detect batchfile. this file uses only ver command and this can't detect server or client. This is because of speed. systeminfo.exe can detect server or client but that is very slow. "ver" comannd returns result very fast.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO off | |
VER | find "95" > nul | |
IF not errorlevel 1 GOTO Win_95 | |
VER | find "98" > nul | |
IF not errorlevel 1 GOTO Win_98 | |
VER | find "NT" > nul | |
IF not errorlevel 1 GOTO Win_NT | |
VER | find "2000" > nul | |
IF not errorlevel 1 GOTO Win_2000 | |
VER | find "XP" > nul | |
IF not errorlevel 1 GOTO Win_XP | |
VER | find "Version 5.2." > nul | |
IF not errorlevel 1 GOTO Win_XP64or2003 | |
VER | find "Version 6.0." > nul | |
IF not errorlevel 1 GOTO Win_Vistaor2008 | |
VER | find "Version 6.1." > nul | |
IF not errorlevel 1 GOTO Win_7or2008R2 | |
VER | find "Version 6.2." > nul | |
IF not errorlevel 1 GOTO Win_8or2012 | |
GOTO unknown_os | |
:win_95 | |
echo "This is Windows 95" | |
goto end | |
:win_98 | |
echo "This is Windows 98" | |
goto end | |
:win_NT | |
echo "This is Windows NT" | |
goto end | |
:win_2000 | |
echo "This is Windows 2000" | |
goto end | |
:win_XP | |
echo "This is Windows XP" | |
goto end | |
:Win_XP64or2003 | |
echo "This is Windows XP 64bit or Windows Server 2003" | |
goto end | |
:win_Vistaor2008 | |
echo "This is Windows Vista or Windows Server 2008" | |
goto end | |
:win_7or2008R2 | |
echo "This is Windows 7 or Windows Server 2008 R2" | |
goto end | |
:win_8or2012 | |
echo "This is Windows 8 or Windows Server 2012" | |
goto end | |
:unknown_os | |
:end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment