0

i am trying to extract a line containing a string from a log file. i am using windows command line findstr command to retrieve it. the command i used is with the following syntax : findstr string file.log and the line gets printed. enter image description here

when trying to store the line in a variable i get the following: enter image description here

how do i store the line in a variable?

user605505
  • 59
  • 1
  • 3
  • 18
  • 2
    Does this answer your question? [How do I get the result of a command in a variable in windows?](https://stackoverflow.com/questions/108439/how-do-i-get-the-result-of-a-command-in-a-variable-in-windows) Specifically, `for /f "delims=" %%A in ('findstr string file.log') do set "variable=%%A"` (or `%A` on the command line). – SomethingDark Aug 22 '23 at 14:43
  • yes, worked perfectly, thank you – user605505 Aug 22 '23 at 15:09

0 Answers0