Ask Your Question
0

How to create an empty file using a batch file?

asked 2023-02-15 11:00:00 +0000

plato gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-06-03 15:00:00 +0000

huitzilopochtli gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-02-15 11:00:00 +0000

Seen: 12 times

Last updated: Jun 03 '21