title: Echo to a file without trailing a line break (batch)
body: <p>I am having a problem with my life creator program.
  It simply chooses random numbers that stand for something and puts it together.
  (I have tried combining variables)
  here is the code:</p>
  
  <pre><code>@set num=1
  @SET /A a=%RANDOM% * 10 / 32768 + 1
  @if %a% == 10 set life%num%= ----
  @if %a% == 9 set life%num%=O
  @if %a% == 8 set life%num%=^
  @if %a% == 7 set life%num%=%
  @if %a% == 6 set life%num%=#
  @if %a% == 5 set life%num%=@
  @if %a% == 4 set life%num%=)
  @if %a% == 3 set life%num%=()
  @if %a% == 2 set life%num%=~
  @if %a% == 1 set life%num%=OO
  @echo %a% &gt;"gencode".txt
  @set num=2
  @SET /A a=%RANDOM% * 10 / 32768 + 1
  @if %a% == 10 set life%num%=----
  @if %a% == 9 set life%num%=O
  @if %a% == 8 set life%num%=^
  @if %a% == 7 set life%num%=%
  @if %a% == 6 set life%num%=#
  @if %a% == 5 set life%num%=@
  @if %a% == 4 set life%num%=)
  @if %a% == 3 set life%num%=()
  @if %a% == 2 set life%num%=~
  @if %a% == 1 set life%num%=OO
  @set life3= %life1%-%life2%
  @echo %life3%&gt;"lifeform".txt
  @echo %a% &gt;&gt;"gencode".txt
  </code></pre>
  
  <p>and here is the variable putter together thing:</p>
  
  <pre><code>@set final= 500
  @set /a pass= %pass% + 1
  @set /a cnum= %cnum% + 1
  @set counterold=%counter%
  @set life%cnum%-%counter%= %a%-%b%
  @if %pass% == 1 goto start
  :repeat
  @if %ficnum% == 500 goto final
  @set life2%cnum%-%counter%= life%counterold%-life%counter%
  @set life2%cnum%-%counterold%= life%counterold%-life%counter%
  @set /a ficnum= %ficnum% + 1
  @set life3%ficnum%-%counter%= life2%counterold%-life2%counter%
  @goto repeat
  :final
  @set /a final= %final% + 1
  @set /a counter= %counter% + 1
  @set /a ficnum= %ficnum% + 1
  @set counter1= %counter%
  @set ficnum1= %ficnum%
  :finalst
  @set /a final= %final% - 1
  @set /a counter1= %counter1% - 1
  @set /a ficnum= %ficnum% - 1
  @set /a ficnum1= %ficnum1% - 1
  @set /a counter= %counter% - 1
  @set final%final%=%life3%%ficnum%-%counter%-%life3%%ficnum1%-%counter1%
  @if %final% == 0 goto finalend
  @goto finalst
  :finalend
  @echo final0&gt;"lifeform".txt
  </code></pre>
  
  <p>So I would like to know, (INSTEAD OF JUST COMBINING EACH VARIABLE TO ONE AND ECHOING THAT TO ONE LINE) how do I set a line to write to so I can just write each variable to one line, creating the life-form.
  I am asking this because every time I echo something it goes down 1 line in the text file.</p>
  
  <p>And here is an experimental version of the life creator:</p>
  
  <pre><code>@set num1=1
  :repeat
  @if %counter% == 500 exit
  @set  /a num1= %num1% + 1
  @SET /A a=%RANDOM% * 10 / 32768 + 1
  @if %a% == 10 set life%num%=----
  @if %a% == 9 set life%num%=O
  @if %a% == 8 set life%num%=^
  @if %a% == 7 set life%num%=%
  @if %a% == 6 set life%num%=#
  @if %a% == 5 set life%num%=@
  @if %a% == 4 set life%num%=)
  @if %a% == 3 set life%num%=()
  @if %a% == 2 set life%num%=~
  @if %a% == 1 set life%num%=OO
  @echo %a% &gt;&gt;"gencode".txt
  @set /a num2= %num% + 1
  @SET /A a=%RANDOM% * 10 / 32768 + 1
  @if %a% == 10 set life%num%=----
  @if %a% == 9 set life%num%=O
  @if %a% == 8 set life%num%=^
  @if %a% == 7 set life%num%=%
  @if %a% == 6 set life%num%=#
  @if %a% == 5 set life%num%=@
  @if %a% == 4 set life%num%=)
  @if %a% == 3 set life%num%=()
  @if %a% == 2 set life%num%=~
  @if %a% == 1 set life%num%=OO
  @set final= 500
  @set /a pass= %pass% + 1
  @set /a cnum= %cnum% + 1
  @set counterold=%counter%
  @set life%cnum%-%counter%= %a%-%b%
  @if %pass% == 1 goto start
  :repeat
  @if %ficnum% == 500 goto final
  @set life2%cnum%-%counter%= life%counterold%-life%counter%
  @set life2%cnum%-%counterold%= life%counterold%-life%counter%
  @set /a ficnum= %ficnum% + 1
  @set life3%ficnum%-%counter%= life2%counterold%-life2%counter%
  @goto repeat
  :final
  @set /a final= %final% + 1
  @set /a counter= %counter% + 1
  @set /a ficnum= %ficnum% + 1
  @set counter1= %counter%
  @set ficnum1= %ficnum%
  :finalst
  @set /a final= %final% - 1
  @set /a counter1= %counter1% - 1
  @set /a ficnum= %ficnum% - 1
  @set /a ficnum1= %ficnum1% - 1
  @set /a counter= %counter% - 1
  @set final%final%=%life3%%ficnum%-%counter%-%life3%%ficnum1%-%counter1%
  @if %final% == 0 goto finalend
  @goto finalst
  :finalend
  @echo final0&gt;"lifeform".txt
  </code></pre>