using System.Text.RegularExpressions;
public static void Main()
string input = "Microsoft Windows [Version 10.0.14393] (c) 2016 Microsoft Corporation. All rights reserved. C:\\Program Files (x86)\\IIS Express>D:\\sample1.bat C:\\Program Files (x86)\\IIS Express>echo ECHO is on. C:\\Program Files (x86)\\IIS Express>echo \"Select * from Table\" \"Select * from Table\" C:\\Program Files (x86)\\IIS Express>exit";
Regex findEcho = new Regex("echo (?<echostring>\".*\")", RegexOptions.Compiled);
var matches = findEcho.Matches(input);
foreach (Match match in matches) {
if (match.Groups["echostring"].Success) {
Console.WriteLine(match.Groups["echostring"].Value);