I am trying to make a batch file that creates messages for other batch files. It first ask for a name to name the file it creates. then then asks to display a message which goes into a spinner for 20 loops and then displays if you would like to clear the screen or continue typing. The problem is that every time I type (Y) in the prompt to clear the text of the created batch file, the prompt closes for an unknown reason. can anyone help?
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
color 17
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo ºBatch Text Editorº
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
echo.
pause
:Restart2
cls
SET /p "FileName= Enter the name of the file you want to name: "
echo @echo off > %FileName%.bat
echo The file %FileName%.bat was created!
pause
cls
SET X=1
:Restart1
if %X% EQU 1 echo Line (1)
SET /p "Message= Type message here: "
echo echo %Message% >> %FileName%.bat
) ELSE (
SET /a X+=1
)
if !X! EQU 21 goto Reboot
echo Line (%X%)
goto Restart1
:Reboot
echo pause >> %FileName%.bat
SET /p "YN=Would you like to clear the screen? (Y/N): "
if %YN%==Y echo. > %FileName%.bat
if %YN%==y echo. > %FileName%.bat
if %YN%==N echo goto Restart2
if %YN%==n echo goto Restart2