Advertisement

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.

Advertisement

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:

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!

Advertisment

Author: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

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

  1. “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 :))

  2. If you create such a file, will it overwrite data that was previously marked as deleted on the disk? Could this be used a way of preventing deleted files being recovered?

Leave a Reply

Your email address will not be published.

css.php
Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.