computing
  • 2

Set For /F Delims As a Line Break

  • 2

Hey I was coding a program when and wanted to set part of the ouput of a command as a variable so I used this code:

for /f “tokens=1 delims=” %%a in (‘MY COMMAND’) do (echo %%a)

But now the only problem is come commands ouput multiple lines of code and I don’t know what to type for delims to mean a line break or a new line. So how could I code this to set the delims as a line break?

Share

1 Answer

  1. I’ll usually overcome that with a FINDSTR, Here’s an example.

    FOR /f "tokens=1 delims=" %%a IN ('Command ^| FINDSTR "String"') do (Command)

    Hope I’ve Helped.

    • 0