how to create a batch file code example
Example 1: how to make a batch file
echo off
title MyBatchFile
color 0
echo This is a batch file
echo.
echo Batch files are made on a Windows PC.
echo They run inside of Command Prompt
echo Copy this code. Next, paste it inside of Notepad.exe.
echo Finally, save it as a .bat or .cmd file, run it, and there you have it!
echo Do you see it now?{Y/N}
set /p answer
if %answer% == Y exit
if %answer% == N goto loop
:loop
cls
echo This is a batch file
echo.
echo Batch files are made on a Windows PC.
echo They run inside of Command Prompt
echo Copy this code. Next, paste it inside of Notepad.exe.
echo Finally, save it as a .bat or .cmd file, run it, and there you have it!
echo Do you see it now(again)?{Y/N}
set /p answer2
if %answer2% == Y exit
if %answer2% == N exit
pause
exit
Example 2: batch write file
REM # | NOTE: this is for batch files (windows cmd)
REM # | EXAMPLE
echo This is the text you want in the actual file > NewFile.txt
REM # | SYNTAX
REM # | echo [insert-text] > [file-name]
Example 3: what is a windows batch file
@ECHO OFF
ECHO Congratulations! Your first batch file executed successfully.
PAUSE