@echo off in DOS (cmd)

Posted by Rayne on Stack Overflow See other posts from Stack Overflow or by Rayne
Published on 2012-09-20T03:35:34Z Indexed on 2012/09/20 3:37 UTC
Read the original article Hit count: 157

Filed under:
|

I'm trying to write a BAT script and I have the following:

@echo off
REM Comments here
SETLOCAL ENABLEDELAYEDEXPANSION
set PROG_ROOT=C:\Prog
set ONE=1

echo 1>> %PROG_ROOT\test.txt
echo %ONE%>> %PROG_ROOT\test.txt

for /f "tokens=*" %%f in (folders.txt) do (
    echo %%f>> %PROG_ROOT\test.txt
)

ENDLOCAL

My folders.txt contains the number "5".

My test.txt output is

ECHO is off
ECHO is off
5

I don't understand why the first 2 lines of output has "ECHO is off", while the third line is printed out correctly. How do I print the correct output?

© Stack Overflow or respective owner

Related posts about echo

Related posts about dos