Create an Empty File in MS-DOS 6.22
This article explains how to instantly create a zero-byte, empty text
file in MS-DOS 6.22 using standard command-line syntax. It covers the
primary commands utilizing the MS-DOS null device (NUL),
explains how each method functions, and highlights common pitfalls to
avoid when generating completely blank files.
The Primary Command: TYPE NUL
The cleanest and fastest command syntax to create an empty 0-byte text file in MS-DOS 6.22 is:
TYPE NUL > filename.txt
TYPE: The internal DOS command used to display the contents of a file.NUL: The built-in DOS null device, which acts as a black hole that yields zero bytes of data when read.>: The standard output redirection operator, which directs the output stream into a target file, overwriting the file if it already exists or creating it if it does not.filename.txt: The name of the file you want to create (constrained by the standard DOS 8.3 filename convention).
Because the NUL device contains nothing,
TYPE outputs nothing, and redirection immediately writes an
empty 0-byte file to the disk without prompting the user.
Alternative Method: COPY NUL
Another standard command syntax supported natively by MS-DOS 6.22 is:
COPY NUL filename.txt
This instructs the COPY command to duplicate the empty
data of the NUL device into filename.txt.
- Behavior: MS-DOS will output confirmation text
stating
1 file(s) copied. - Result: Generates an identical 0-byte file on disk.
To suppress the confirmation message in batch scripts, redirect the output:
COPY NUL filename.txt > NUL
Why Not to Use ECHO
A common mistake in DOS scripting is using the ECHO
command:
ECHO. > filename.txt
This does not create an empty file. In MS-DOS 6.22,
ECHO. outputs a carriage return and line feed (CR/LF),
resulting in a file that is 2 bytes in size rather than 0 bytes. Always
use NUL via TYPE or COPY to
guarantee a completely empty file.