Multiple RegEx in findstr /r /c:"RegExs"
Posted: 16 Mar 2017 14:28
Hi,
I wrote this code:
I need to put both RegEx in the same findstr, to simplify the code, and mainly to avoid this output when work with Windows 10:
Vista and older
Vista and newer,
since Windows 10 version begins with 10 and while cmd parsing the code first read "[ ]6"
Some Idea, or some alternative solution?
Thanks and regards.
I wrote this code:
Code: Select all
@echo off
title version detection
cls
for /f "tokens=*" %%n in ('ver ^| findstr /r /c:"[ ]6"') do set ver_1="%%n"
for /f "tokens=*" %%n in ('ver ^| findstr /r /c:"[ ]10"') do set ver_2="%%n"
if /i [%ver_1%]==[] (echo Vista and older) else goto code_2
if /i [%ver_2%]==[] (echo Vista and older) else goto code_2
:code_2
echo Vista and newer!
exit
I need to put both RegEx in the same findstr, to simplify the code, and mainly to avoid this output when work with Windows 10:
Vista and older
Vista and newer,
since Windows 10 version begins with 10 and while cmd parsing the code first read "[ ]6"
Some Idea, or some alternative solution?
Thanks and regards.