1

I'm making some batch files to personalise my Windows installations faster, but I need my batch to take a path depending on which Windows version it's running on.

If I could get the Windows version into a variable I could build a conditional to take the right path.

I've been looking for an answer on google and even here but the answers I've got don't meet what I need.

Could someone help me please?

AJM
  • 500
Brlesskoin
  • 21
  • 1
  • 1
  • 2

1 Answers1

1

If you're looking for the version number, that has been answered here: https://stackoverflow.com/a/13212088/1337519

C:\Users\somedude>wmic os get version
Version
6.1.7601

C:\Users\somedude>

and here: https://stackoverflow.com/a/13212116/1337519

@echo off
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.
rem etc etc
endlocal