As Aacini mentioned, it's not possible to use a single set /p
.
You could use a loop of set /p
, but you need a type of end marker to leave the loop.
Or you could use copy con input.tmp
, but then you have to finish the input with CTRL-Z.
A sample with sep /p
stopping at the first empty line.
@echo off
setlocal EnableDelayedExpansion
SET LF=^
REM ** Two empty lines are required
call :input
echo !input!
exit /b
:input
set "input="
:inputLoop
set "line="
set /p "line=Enter text, stop with an empty line :"
if defined line (
set "input=!input!!line!!LF!"
goto :inputLoop
)
exit /b