'How to get entire line that contains given string using findstr in batch script?

I need to get the line that contains the keyword ProductVersion from one of my svn repository csproj files. I have tried below code, but it is not working as expected.

The batch file is:

@echo off
setlocal enabledelayedexpansion
rem https://testur/test.csproj
for %%t in (%*) do (
    rem echo url: %%t
    for /f "tokens=1" %%c in ('svn cat %%t ^| findstr /i ProductVersion') do (
        echo output: %%c
    )
)

csproj file content:

<VisualStudioProject>
    <CSHARP
        ProjectType = "Local"
        ProductVersion = "7.10.3077"
        Schemaversion = "2.0"

Here the url is passed as command line argument to the batch file. The ProductVersion line in csproj file also contains = and some spaces. svn cat %%t would return me the content of file test.csproj. I am applying findstr on the received file content. When I tried with above code it returns only ProductVersion without the remaining string "7.0.3077" as output.

How to get the ProductVerion value 7.0.3077 or the entire line?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source