Make a line break when requesting user input (/P) in batch?

EpicCyndaquil picture EpicCyndaquil · May 14, 2013 · Viewed 9.1k times · Source

Is it possible to create a line break after a set /P command? I would like the user to be able to type on a new (blank) line instead of next to the existing prompt. For example:

set /P test=type now

echo %test%

This code simply lets the user type next to the prompt.

Answer

paxdiablo picture paxdiablo · May 14, 2013

If you want input on the following line, just use:

echo type now
set /p test=
echo %test%

The echo will output the prompt including the newline, then you just use set /p with no prompt.