At the moment I have
echo ping %id% > 1.bat
But I want to copy more than one line of code into another file.
Any ideas?
At the moment I have
echo ping %id% > 1.bat
But I want to copy more than one line of code into another file.
Any ideas?
echo first line >1.txt
echo second line >>1.txt
echo third line >>1.txt
...
Option 1 - (same as what Stephan posted)
echo first line >1.bat
echo second line >>1.bat
Option 2
>1.bat (
echo first line
echo second line
)
Option 3
call :output >1.bat
exit /b
:output
echo first line
echo second line
exit /b
Options 2 and 3 are significantly faster than option 1 if you are writing lots of output because they only have to open and position the stream pointer once, whereas option 1 must open and position for each line.