computing
  • 20

Solved How To Append Text To Text File With No New Line Using CMD

  • 20

Hi, Am trying to append value to a property file “echo content >>filename”
its appending content as a new line. But i wish to append the “content” on the same line.Please, help me on this.

Ex : Original txt file content

hi
hello

But want to append like

hi hello

Share

1 Answer

  1. setlocal EnableDelayedExpansion
    set "line="
    for /f "delims=" %%a in (myfile.txt) do (
      set "line=!line!%%a"
    )
    >newmyfile.txt echo !text!
    
    

    please test, works for the above case

    ::mike

    • 0