-2

This is the command I am using in my batch file.

echo.>"E:\data\text.txt"

This successfully creates the text.txt file in the destination folder, but inside the text.txt file, a new line break is added by default.

How do I create an empty file without line breaks?

Compo
  • 36,585
  • 5
  • 27
  • 39
swetha
  • 91
  • 2
  • 11
  • 1
    All lines Windows text files end with a Carriage Return and Line Feed pair, there is nothing wrong with that. In this particular case, it is being introduced by the `echo` command. If you don't want it, don't use `echo`, use ```CD.>"E:\data\text.txt"``` instead. – Compo Aug 25 '22 at 10:57

2 Answers2

1

You can do this as follows:

type nul > E:\data\text.txt

The result will be a file, having file size zero (so not even an empty line).

Dominique
  • 16,450
  • 15
  • 56
  • 112
0

cd.>"E:\data\text.txt" helped me. It just created an empty file without any line breaks

swetha
  • 91
  • 2
  • 11