Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Batch file: Check if OS is Windows 10

I want to make a batch file which will do the following operation: checks if the running OS is windows. If it is than it should print Hello. Im win 10 else should print other message. How can i do this if condition?

Pseudocode:

if OS == Win10 then
   echo Hello im win 10
else
   echo I am another os
like image 507
Martin Rezyne Avatar asked Dec 16 '15 17:12

Martin Rezyne


People also ask

How do I find my OS version using CMD?

Checking your Windows version using CMD Press [Windows] key + [R] to open the “Run” dialog box. Enter cmd and click [OK] to open Windows Command Prompt. Type systeminfo in the command line and hit [Enter] to execute the command.

Which of the following commands can be used to verify the Windows 10 edition?

ver | find "Version 10."


1 Answers

setlocal
for /f "tokens=4-5 delims=. " %%i in ('ver') do set VERSION=%%i.%%j
if "%version%" == "6.3" echo Windows 8.1
if "%version%" == "6.2" echo Windows 8.
if "%version%" == "6.1" echo Windows 7.
if "%version%" == "6.0" echo Windows Vista.
if "%version%" == "10.0" echo Windows 10.
echo %version%
rem etc etc
endlocal
like image 104
Vertexwahn Avatar answered Oct 07 '22 14:10

Vertexwahn