What does ECHO.> Mean in a batch file?

I have a batch file with the following code inside:

ECHO .> C:\file.txt

      

I've read about ECHO and understand what it is used for, but what I don't know is the characters that are used after the word echo ( .>

) and the file path is used after that.

+3


source to share


2 answers


It is used to trim or create a file of your need. echo .

outputs one line, which is redirected to a file, effectively truncating it.
To get a completely empty file, I often use cd . > filename

. I don't know where I picked it, but it has been on UNIX systems for a long time.



+4


source


>

redirects the command output earlier.

echo .>c:\file.txt

prints point in file c:\file.txt

, overwriting its content (so it will only contain point)



I think you were wrong. Typically echo.>file.txt

used to create an empty file (or delete content if the file exists). (Note the missing space)

+1


source







All Articles