Solved How to declare the value of the VER command into a variable?

September 15, 2017 at 11:36:45
Specs: Windows 10, 1.9mhz 12GB
If you type VER in DOS, the output is Microsoft Windows [Version 10.0.14393]
I wanna use that in a batchfile, so that's why I want to put that in variable called %Version%

I then wanna ask:
IF %Version% equals hardcoded string (Microsoft Windows [Version 10.0.14393]) then replace string1 with string2 ELSE go out of this loop


How do I do that in the correct manner?

message edited by JacopoWeiss


See More: How to declare the value of the VER command into a variable?

Reply ↓  Report •

#1
September 16, 2017 at 04:53:41
✔ Best Answer
:: It ain't DOS it's WINDERS
::
:: Here how you set the var
::
::====== script starts here ===============
::
:: jaco.bat 2017-09-16 18:49:09.14
@echo off > NEWFILE & setLocal enableDELAYedeXpansioN

:main
for /f "tokens=* delims= " %%a in ('ver') do (
set version=%%a
)
set v
goto :eof
::====== script ends here =================

=====================

M2 Get custom script or take private lessons


Reply ↓  Report •
Related Solutions


Ask Question