How can I preserve entered indent spaces in batch on user prompt?

Viewed 201

I am trying to get input whilst outputting over multiple lines, for example:

set /p var="Please enter a value:

    "

The user should type on the third line at the speech mark ", but instead it makes the user type after the colon :.

Or alternatively I could use:

echo Please enter a value:
echo.
set /p var="    "

But the indent isn't retained in the output.

Is there a way to fix this?

EDIT:

Would it be possible to use a blank space or black character instead of the first space, if so, which one?

1 Answers

Try:

@echo off

set /p ^"var=Please enter a value:^

^

     ^"

Perhaps clearer:

@echo off

set /p ^"var=Please enter a value:^
%empty line%
^
%empty line%
     ^"
Related