How do I append an empty line in a text file using the command line?
echo hi >a.txt
echo >>a.txt
echo arun >>a.txt
Here the output comes as:
hi
echo on
arun
So how could I append an empty line? I want it to be like this:
hi
arun
When I added this line on code @echo off, it said echo off. How can it be done?
In the Windows command prompt, try:
Note that there is no space between
echoand.; if there is one, it will output a dot. There is also no space between the.and the>>; anything in between would be output to the file, even whitespace characters.See the Microsoft documentation for
echo.If this were in bash, your first try would have been correct:
But in Windows, the unqualified
echocommand tests whether there is a command prompt or not (echo offturns the prompt off andecho onturns it back on).