The ^
character is the batch file "escape" character. When used by itself at the end of a line, it becomes a line-continuation character, used for treating multiple lines as a single line.
So, in a batch file, if you put in
echo This ^
is a single ^
line!
It treats it as a single line, equivalent to:
echo This is a single line!
If there is no "next line" in the batch, like in your single line batch example of do ^
, there's no next line to append, so it doesn't append anything (and therefore appears to do nothing).
When you use the ^
line-continuation at a command prompt, it will show you the More?
prompt because you told it you want to continue the command on the next line, at which point you can continue the command, e.g.:
Y:\>echo This ^
More? is a single ^
More? line!
This is a single line!
To have a batch file stop and prompt for input, you would want to look into using set /p
, which will prompt for input and then assign that input to a variable. e.g.:
set /P name="What Is Your Name? "
echo Hello %name%!