@echo on
setlocal
@echo This is stdout stream 1.
@>&2 echo This is stderr stream 2.
@>&3 echo This is stdout stream 3.
(
rem echo hello
) & echo hello
rem CD: "%cd%"
rem %%*: %*
for %%A in (1 2 3) do (
rem remark
echo(%%A
)
>&2 echo Error line1.
rem Get first name of the user.
set "first="
>&3 set /p "first=First Name: "
echo "%first%"
>&2 echo Error line2.
rem Get last name of the user.
set "last="
>&3 set /p "last=Last Name: "
echo "%last%"
echo Press only return at pause
>&3 pause
rem Print greeting with first and last name.
echo Hello %first% %last%
>&2 echo Error line3.
rem Prompt the user to end.
set "reply=y"
>&3 set /p "reply=Ready to end? [y|n]: "
echo "%reply%"
if /i "%reply%" == "y" (
rem Good finish.
echo Bye
) else if /i "%reply%" == "n" (
rem Alternative finish.
echo Nice try, bye
) else echo ... bye
exit /b %random:~-1%