Ask Your Question

Revision history [back]

To create an empty file using a batch file, you can use the following command:

type nul > filename.txt

This command will create an empty file named "filename.txt" in the current directory.

Alternatively, you can use the following command:

echo. > filename.txt

This command will also create an empty file named "filename.txt" in the current directory.

Note that if the file already exists, these commands will overwrite the existing file. If you want to avoid overwriting existing files, you can use the following command instead:

if not exist filename.txt type nul > filename.txt

This command will create the file "filename.txt" only if it doesn't already exist.