How copy text between special characters in DOS Batch? -


i need echo text out of string if special text found. text need echo between ().

in following code fragment need search "language=" within (). if "language=" found need echo text that's within () console.

with string1 echo language=en should printed.

with string2 nothing should echoed.

any highly appreciated.

@echo off setlocal enabledelayedexpansion  set string1=what nice morning (language=en). more text. set string2=what nice morning. more text.  call :fetchlanguage "%string1%" call :fetchlanguage "%string2%"  pause   :fetchlanguage    echo parse string %1     echo "%1" | findstr /c:"language=" 1>nul     if errorlevel 1 (       echo language not found     ) else (       echo found language  rem *** need echo language=xyz here.         )        exit /b 

try /f

for /f "tokens=2 delims=()" %%l in ('echo "%1" ^| findstr "language="') (   echo %%l )  

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -