computing
  • 0

Writing Mutiple Lines Using Batch File

  • 0

Hello Friends,

I wish to write multiple lines using batch files to a new file..

for example,

This is line 1
This is line 2
This is line 3
.
.
.
This is line N

I know this,

ECHO This is line 1 >>temp.txt
ECHO This is line 2 >>temp.txt
ECHO This is line 3 >>temp.txt
.
.
.
ECHO This is line N >>temp.txt

What I wish to know, instead of writing echo and >>temp.txt on everyline, can we group them together like we do in shell scripting..

Regards,
Ash

Share

1 Answer

  1. What you can also do, is this (it’s just another way, maybe it suits the question):

    ————————
    script1.cmd
    ————————
    echo This is line 1
    echo This is line 2
    echo This is line 3
    echo This is line 4

    ————————
    script2.cmd
    ————————
    call script1.cmd > ouput.txt

    • 0