Windows: Generate a File of any Size with Fsutil

Inevitably, there will come a time when you will need files of various sizes to test application performance or to conduct a simple test on a new drive. Rather than hunt around for a file that fits your needs you can make use of the Fsutil command in Windows to create a file of any size, I would say the limit to how big of file you can create depends on the amount of free space available. Like I said before, in Windows you can use Fsutil to generate the file, the correct command would go like this.

fsutil file createnew

In the real world the command would actually look like this:

fsutil file createnew f:/web/speedtest/1gb.bin 1073741824

What this command did was create a 1GB file in a directory located in another drive and it only took seconds for the file to be generated.

Command Explained:

Fsutil is easy to understand, in the example above I want to create a 1GB file inside an existing directory located in a separate drive. If you want to keep the file in the local drive all you would have to change would be the drive letter from F: to C:. Equally important is the fact that you have to specify the size of the resulting file in bytes.

Fsutil @ Technet