I'm new to batch and trying to format the way my file runs, so the user input following the line below is not in the same line with the "What's your name?" part, if that makes sense.
set /p "Playername=What's your name?"
I tried using:
/f "eol=\" tokens=3 delims=:{ " %%A in (SType_txt.sys) do echo %%A
(copy-pasted from somewhere online without fully understanding the contents) and using " \ " as a EOL as shown below,
set /p "Playername=What's your name?" \
but that just doesn't work, no error-message or anything, just not doing what I wanted.
What can I do to stop the input being positioned right after the question but in the line below?
CodePudding user response:
The prompt portion of a set /p
command is optional, so you can simply
echo What's your name?
set /p "Playername="
and the user will enter their response on the line underneath of the displayed text.
CodePudding user response:
Alternatively create a variable containing a new line character:
@Echo Off
SetLocal EnableExtensions EnableDelayedExpansion
(Set \n=^
% 0x0A %
)
:GetName
Set "PlayerName="
Set /P "PlayerName=What is your name?!\n!>" || GoTo GetName