1.

Solve : Stop writing "echo"?

Answer»

Is there a way I could stop writing echo so many times but NOT in a continuous line?

What I mean is how could I do this

Code: [SELECT]echo Hi
echo other
echo stuff
echo here

but without writing echo so many times.

THANKS in advance!CTRL C
CTRL V ? ?I would still be writing a whole bunch of echos. The thing I'm trying to fix is not writing echo itself so many times.You could put your text into a file then TYPE it - as long as all the text is needed to appear together
So you don't like writing echo?  Join the madhouse!

Try this:

Code: [Select]set fred=echo

%fred% Hi
%fred% other
%fred% stuff
%fred% here
Quote

Is there a way I could stop writing echo so many times but NOT in a continuous line?

Yes, learn Powershell

If you mean NT batch, everything is a tradeoff. This little ditty requires a single echo command.. Better? You be the judge.

Code: [Select]echo off
for %%i in ("Hi" "Other" "Stuff" "Here") do echo %%~i

 
Code: [Select]set string="1 Paris" "2 London" "3 Rome" "4 Madrid"
for %%A in (%string%) do echo %%~A
Do you write with notepad?
Just write your stuff without using the word 'echo'. Substitute a symbol, maybe the character.
Then when you are done, use the replace all feature to change every to echo.
Is that not what you want?

Quote from: T.C. on November 14, 2011, 01:34:41 AM
So you don't like writing echo?  Join the madhouse!

Try this:

Code: [Select]set fred=echo

%fred% Hi
%fred% other
%fred% stuff
%fred% here

if you were brought up on BASIC you could do this to make yourself feel at home

Code: [Select]echo off
set gosub=call
set return=goto :eof

echo main code
%gosub% :subroutine
%gosub% :subroutine
%gosub% :subroutine
pause
exit

:subroutine
echo in subroutine
%return%


Quote from: Salmon Trout on November 17, 2011, 01:19:50 PM
if you were brought up on BASIC you could do this to make yourself feel at home


Would that be IBM Basic assembly language for system 360? Quote from: T.C. on November 17, 2011, 08:06:32 PM
Would that be IBM Basic assembly language for system 360?

IBM Basic assembly language doesn't have either RETURN or GOSUB instructions, which are pretty MUCH exclusive to dialects of BASIC. (BASIC != Basic)Just adding my two cents.
Code: [Select]echo off
CALL :ECHOS HI other stuff here
GOTO :EOF

:ECHOS
:ELOOP
IF "%1"=="" GOTO :EOF
echo %1
SHIFT
GOTO ELOOPMaybe the OP should tell us What he wants to do instead of How to do it.
As mentioned earlier, the TYPE command is used echo a whole text file.

Are you still thee? Please shoe an example whee you really did use echo many times in a batch file. He hasn't ben back in 3 WEEKS...


Discussion

No Comment Found