Microsoft KB Archive/65094

How to Create a Zero-Length File PSS ID Number: Q65094 Article last modified on 02-16-1993 PSS database name: O_MSDOS

3.20 3.21 3.30 3.30a 4.00 4.01

MS-DOS

Question:

I need to create a zero-length file (one that allocates no disk space) for use as a placeholder in an MS-DOS directory. Is there an easy way to accomplish this using MS-DOS, or must a small program be written?

Response:

You can create a zero-length file from the command prompt or from within a batch file by using redirection in combination with the REM command. Because the REM command is a null command (that is, it is skipped by the command processor), it generates no output. If the output redirection is used on this command, MS-DOS will create a file, but nothing will be placed into the file.

The following command will create a zero-length file with the name “test” in the current directory:

rem >test

Note that the MS-DOS COPY command will not copy zero-length files. To copy zero-length files, use the XCOPY command.

Additional reference words: 3.20 3.21 3.30 3.30a 4.00 4.01 noupd

Copyright Microsoft Corporation 1993.