It's programming time!/Batch/Echo/More

From Create Your Own Story

Echo/More

There are all kinds of ways you can use echo. Let's try some cool stuff with it.

This example outputs some files. Be careful not to overwrite something accidentally.

You should have the hang of making batch files by now:

@echo OFF
echo Time for some fun with echo.
echo.
rem use echo. to add a blank line to the output.

echo Where'd this text go? > "Oh here it is.txt"
echo You can store variables using the set command and = operator.
set myVar=This is a variable.
echo.
echo And you can display variables using the echo command.
echo %myVar%
echo.
pause

echo You can also use echo to write to files.
echo This stuff is in newFile.txt >> "newFile.txt"
echo You can then use type to read files.
type newFile.txt

pause
You can run this file more than once to see how > and >> work differently.
Personal tools