@echo off
setlocal
set /p "_myvar=what is your name?"
echo HELLO!>file.txt
echo %_myvar%!>>file.txt
echo done!
pause
type file.txt
endlocal
exit

Now file.txt looks like:

HELLO!
John Smith!

(assuming you typed John Smith as your name.)

Now your batch file's console looks like:

what is your name?John Smith
done!
Press any key to continue...
HELLO!
John Smith!

( and it should exit so quickly that you may not be able to see anything after the prompt Press any key to coninue... )