How do you make a multi lined text document within a batch file? -
what mean this:
echo testing >> new_text_document.txt
is there way give "testing" multiple lines?
might work better variables like:
set xyz= testing echo %testing% >> new_text_document.txt
i don't know. if can help, apreaciated. in advance.
there many ways, depends on need. 1 way put newline in variable (note 2 empty lines critical):
@echo off setlocal enabledelayedexpansion set nl=^ echo two!nl!lines >> new_text_document.txt
use 1 or 2 > not matter. since >> appends can many lines of echo too
@echo off :other stuff echo multiple >> new_text_document.txt echo lines >> new_text_document.txt echo. >> new_text_document.txt echo of text >> new_text_document.txt
that may clunky instead
@echo off :other stuff ( echo multiple echo lines echo. echo of text ) >> new_text_document.txt
last not least can similar bash trick have no eol marker.
@echo off more +4 %~f0 >> new_text_document.txt exit /b multi line text
in addition possible loop file way can have eol marker many different pieces.
Comments
Post a Comment