Tutorial by Examples

@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 consol...
This example echoes the special character ! into a file. This would only work when DelayedExpansion is disabled. When delayed expansion in enabled, you will need to use three carets and an exclamation mark like this: @echo off setlocal enabledelayedexpansion echo ^^^!>file echo ^>>&...
@echo off cls echo Please input the file path, surrounded by "double quotation marks" if necessary. REM If you don't want to redirect, escape the > by preceding it with ^ set /p filepath=^> echo Writing a random number echo %RANDOM% > %filepath% echo Reading the random n...

Page 1 of 1