How to Create & Delete File with Command Line on Windows

This post covers how to create and delete files with command line also called cmd on Windows OS. I am using Windows 10 but these commands should work on Windows 7, windows 8 and windows 11 too.

Create an empty file with desired filename and file extension

echo '' > filename.ext
echo nul > filename.txt

Echo with command line in a file

echo on windows, writes your text as it is.

echo your text > filename.txt

Delete file with command line

del filename.ext