Thursday, March 5, 2009

How to make an empty file on Windows

To makes an "empty" file,  containing only a single newline, type this in a Windows command prompt:
c:\>echo. > somefile.txt

The dot immediately after the echo command outputs just a blank line to the file. I think this technique works for Windows NT and better.

Apparently you can also use the fsutil command to make a file of any size filled with zeros:
c:\>fsutil file createnew filename length