Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Stop writing "echo"  (Read 3963 times)

0 Members and 1 Guest are viewing this topic.

shanked

    Topic Starter


    Beginner
    • Experience: Familiar
    • OS: Windows Vista
    Stop writing "echo"
    « on: November 13, 2011, 08:01:02 PM »
    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!
    ...

    patio

    • Moderator


    • Genius
    • Maud' Dib
    • Thanked: 1769
      • Yes
    • Experience: Beginner
    • OS: Windows 7
    Re: Stop writing "echo"
    « Reply #1 on: November 13, 2011, 08:07:38 PM »
    CTRL C
    CTRL V ? ?
    " Anyone who goes to a psychiatrist should have his head examined. "

    shanked

      Topic Starter


      Beginner
      • Experience: Familiar
      • OS: Windows Vista
      Re: Stop writing "echo"
      « Reply #2 on: November 13, 2011, 08:25:23 PM »
      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.
      ...

      gpl



        Apprentice
      • Thanked: 27
        Re: Stop writing "echo"
        « Reply #3 on: November 14, 2011, 01:08:02 AM »
        You could put your text into a file then TYPE it - as long as all the text is needed to appear together

        T.C.



          Beginner

          Thanked: 13
          Re: Stop writing "echo"
          « Reply #4 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

          Sidewinder



            Guru

            Thanked: 139
          • Experience: Familiar
          • OS: Windows 10
          Re: Stop writing "echo"
          « Reply #5 on: November 14, 2011, 05:59:18 AM »
          Quote
          Is there a way I could stop writing echo so many times but NOT in a continuous line?

          Yes, learn Powershell ;D

          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

           8)
          « Last Edit: November 14, 2011, 06:28:33 AM by Sidewinder »
          The true sign of intelligence is not knowledge but imagination.

          -- Albert Einstein

          Salmon Trout

          • Guest
          Re: Stop writing "echo"
          « Reply #6 on: November 17, 2011, 12:54:05 PM »
          Code: [Select]
          set string="1 Paris" "2 London" "3 Rome" "4 Madrid"
          for %%A in (%string%) do echo %%~A

          Geek-9pm


            Mastermind
          • Geek After Dark
          • Thanked: 1026
            • Gekk9pm bnlog
          • Certifications: List
          • Computer: Specs
          • Experience: Expert
          • OS: Windows 10
          Re: Stop writing "echo"
          « Reply #7 on: November 17, 2011, 01:04:01 PM »
          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?


          Salmon Trout

          • Guest
          Re: Stop writing "echo"
          « Reply #8 on: November 17, 2011, 01:19:50 PM »
          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%



          T.C.



            Beginner

            Thanked: 13
            Re: Stop writing "echo"
            « Reply #9 on: November 17, 2011, 08:06:32 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?

            BC_Programmer


              Mastermind
            • Typing is no substitute for thinking.
            • Thanked: 1140
              • Yes
              • Yes
              • BC-Programming.com
            • Certifications: List
            • Computer: Specs
            • Experience: Beginner
            • OS: Windows 11
            Re: Stop writing "echo"
            « Reply #10 on: November 17, 2011, 09:12:13 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)
            I was trying to dereference Null Pointers before it was cool.

            Squashman



              Specialist
            • Thanked: 134
            • Experience: Experienced
            • OS: Other
            Re: Stop writing "echo"
            « Reply #11 on: December 09, 2011, 06:58:55 PM »
            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 ELOOP

            Geek-9pm


              Mastermind
            • Geek After Dark
            • Thanked: 1026
              • Gekk9pm bnlog
            • Certifications: List
            • Computer: Specs
            • Experience: Expert
            • OS: Windows 10
            Re: Stop writing "echo"
            « Reply #12 on: December 09, 2011, 08:48:02 PM »
            Maybe 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.

            patio

            • Moderator


            • Genius
            • Maud' Dib
            • Thanked: 1769
              • Yes
            • Experience: Beginner
            • OS: Windows 7
            Re: Stop writing "echo"
            « Reply #13 on: December 10, 2011, 05:50:44 AM »
            He hasn't ben back in 3 weeks...
            " Anyone who goes to a psychiatrist should have his head examined. "