Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I see three possible workarounds.</p> <p><strong>1) Building the line combining multiple for-parameters.</strong> </p> <pre><code>@echo off SETLOCAL EnableDelayedExpansion set "line=" for %%a in ("line1" "line2" "line3" "line4" ) do set line=!line!%%~a echo !line! </code></pre> <p><strong>2) Leaving the "quote" at the end of each line</strong></p> <pre><code>@echo on SETLOCAL EnableDelayedExpansion set "line=line1 &amp; x#"^ "line2 &amp; a#"^ "line3 &amp; b #"^ "line4 &amp; c " set "line=!line:#" "=!" echo !line! </code></pre> <p>The first space in each line is important, because the caret works as multiline character but it also escapes the first character, so also a quote would be escaped.<br> So I replace the unnessary #" " after building the line.</p> <p><strong>EDIT Added: 3) Disappearing quotes</strong></p> <pre><code>setlocal EnableDelayedExpansion echo "A very long line I want to !"=!^ split into two lines" </code></pre> <p>In my opinion this is the <em>best</em> way, it works as the parser first see the quotes and therefore the last caret will work, as it seems to be outside of the quotes.<br> But this <code>!"=!</code> expression will expand the variable named <code>"=</code>, but such a variable name can't exists (an equal sign can only occur as first character) so it expands to nothing. </p> <p>You can also create <em>safe</em> expressions, they will always escape out of quotes, independent if there is a quote or not in the line.<br> <code>!"^"=!</code></p> <pre><code>echo This multiline works !"^"=!^ as expected echo "This multiline works !"^"=!^ too" </code></pre> <p>If you want avoid delayed expansion, you could also use a -FOR-Loop like</p> <pre><code>for %%^" in ("") do ( echo "This multiline works %%~"^ too" ) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload