How to create an empty file in Windows Command Prompt (CMD)?

In Windows command Prompt, both type & echo can create a file

for creating empty file, for example a text file

type nul > NewOrExistingFile.txt

for adding content to new or existing file by echo

echo some text > NewOrExistingFile.txt

and for type it puts content of another file

type ExistingFile.txt > NewOrExistingFile.txt

and in both of them for appending content instead of overriding content we use >>

echo some text >> NewOrExistingFile.txt
type ExistingFile.txt >> NewOrExistingFile.txt

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top