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.
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.
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.
- Open an elevated command prompt.
- Type or copy-paste the following command:
fsutil file createnew <filename> <length>
- Substitute the <filename> portion with the actual file name.
- 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
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:
- Enable Case Sensitive Mode for Folders in Windows 10
- How to Enable TRIM for SSDs in Windows 10
- Everything you need to know about symbolic links in Windows 10
- How to see if TRIM is enabled for SSD in Windows 10
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!