chetan1981
asked on
suppressing echo is off msg
Stupid question, but why would this piece id code say Echo is off. in the output. It puts out the required output then also says echo is offin the next line...I just see echo called once?? Could someone help me get rid of 'echo is off'
Thanks
@echo off
set InputFile=in.txt
set OutputFile=out.txt
if exist "%OutputFile%" del "%OutputFile%"
for /f "skip=3 delims=" %%a in ('type "%InputFile%"') do >>"%OutputFile%" echo %%a
back to top
Thanks
@echo off
set InputFile=in.txt
set OutputFile=out.txt
if exist "%OutputFile%" del "%OutputFile%"
for /f "skip=3 delims=" %%a in ('type "%InputFile%"') do >>"%OutputFile%" echo %%a
back to top
If %%a = nothing then all you have there is "echo".
ASKER
Thx leew, so how do I make it stop before it gets to where %%a is nothing
Your "DO" command should actually do something. Are you trying to echo %%a TO %OutputFile%?
ASKER
yeah, just adding lines from one file to another
then it should be DO echo %%a >> %OutputFile%
it works fine for me. I am using win XP cmd.
ASKER
I tried that....it still says echo is off
Thanks
Thanks
rem out that line with the FOR loop and replace it with
echo %%a
What is the output there?
echo %%a
What is the output there?
sorry. won't work. rem it out and make a copy of it, but don't include the >> %OutputFile%.
What is the output?
What is the output?
ASKER
No output, in case it helps I am just copying line #4, the way it works now is that it skips the first 3 lines and gets the 4th line. Maybe instead of the for loop I could just get line#4 ?
Thanks for your patience..
Thanks for your patience..
Try removing the quotes from around %InputFile% in the FOR loop. They would cause it to read that as a string instead of a variable.
ASKER
here's the outputat the console
C:\Tmp\sql_check>set InputFile=MSSQLD004.txt
C:\Tmp\sql_check>set OutputFile=MSSQLD001.txt
C:\Tmp\sql_check>if exist "MSSQLD001.txt" del "MSSQLD001.txt"
C:\Tmp\sql_check>rem for /f "skip=3 delims=" %a in ('type "MSSQLD004.txt"')
do echo %a>>MSSQLD001.txt
C:\Tmp\sql_check>for /F "skip=3 delims=" %a in ('type "MSSQLD004.txt"') do
echo %a
C:\Tmp\sql_check>rem type MSSQL.txt >> data1.txt
C:\Tmp\sql_check>
C:\Tmp\sql_check>set InputFile=MSSQLD004.txt
C:\Tmp\sql_check>set OutputFile=MSSQLD001.txt
C:\Tmp\sql_check>if exist "MSSQLD001.txt" del "MSSQLD001.txt"
C:\Tmp\sql_check>rem for /f "skip=3 delims=" %a in ('type "MSSQLD004.txt"')
do echo %a>>MSSQLD001.txt
C:\Tmp\sql_check>for /F "skip=3 delims=" %a in ('type "MSSQLD004.txt"') do
echo %a
C:\Tmp\sql_check>rem type MSSQL.txt >> data1.txt
C:\Tmp\sql_check>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.