Create a File of Specific Size in Windows 10

Sometimes you need to create a file of specific size for testing purposes. While you can try to create just a text file with some app like Notepad, it is very inconvenient when you need to create a huge file or many files at once. Here is a better solution.

Binary Banner Logo

Windows comes with a special console tool, fsutil. Fsutil targets advanced users and system administrators. Some that I think may be of interest are discussed. It performs tasks that are related to file allocation table (FAT) and NTFS file systems, such as managing reparse points, managing sparse files, or dismounting a volume. If it is used without parameters, Fsutil displays a list of supported subcommands. The tool is available in Windows starting in Windows XP.

You must be logged on as an administrator or a member of the Administrators group to use Fsutil. It may be necessary to enable the WSL feature to get full fsutil functionality.

One of the fsutil parameters is "file". It contains a set of subcommands which can be used to find a file by user name (if Disk Quotas are enabled), to query allocated ranges for a file, to set a file's short name, to set a file's valid data length, to set zero data for a file, to create a new file.

In our case, we need to use the fsutil app as follows.

To create a file of specific size in Windows 10, do the following.

  1. Open an elevated command prompt.
  2. Type or copy-paste the following command:
    fsutil file createnew <filename> <length>
  3. Substitute the <filename> portion with the actual file name.
  4. Substitute <length> with the desired file size in BYTES.

The following command will create the file winaero.bin with size of 4 kilobytes under the location c:\data.

fsutil file createnew c:\data\winaero.bin 4096

Windows 10 Create File Of Specific Size

Tip: Do not forget to wrap around the path to your file with quotes if it contains spaces.

See the following articles to learn more on how you can use the fsutil app:

2 thoughts on “Create a File of Specific Size in Windows 10

  1. Rick Grunwald

    “e following command will create the file winaero.bin with size of 4 bytes under the location c:\data.
    fsutil file createnew c:\data\winaero.bin 4096”

    That makes a file of 4 KILObytes :))

    Reply
    1. Sergey Tkachenko Post author

      sorry, a typo :-)

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *