Skip to content

Generate File of Specific Size in Windows (Very Simple)

generate file of specific size in windows

Sometimes you just need a large file to test some web forms, APIs, or disk performances.

Usually, you would go to a site to download that file.

But in this post, I’m going to show you how to quickly and easily generate a binary file of any size on a Windows machine.

So you don’t have to waste your time.

Let’s get started!

 

Open theΒ Command Prompt as Administrator.

Run the following command:

fsutil file createnew <file> <size in bytes>

For example, this command will create a 1GB file called dummyFileon my Desktop.

fsutil file createnew C:\Users\Carol\Desktop\dummyFile 1073741824


Here is a table with some common file sizes:

MB Bytes (in binary)
1 1048576
5 5242880
10 10485760
50 52428800
100 104857600
500 524288000
1000 1048576000
10000 10485760000

Just out of curiosity, if we open the file and inspect its content using Visual Studio Code Hex Editor extension we can see the file is indeed binary and it’s full of 00s.

In human language, that means it’s full of NULL values.

generate files of specific size in windows

That’s it! πŸŽ‰

Happy coding 😊


Let me know what you think about this article in the comments section below.

If you find this article helpful, please share it with others and subscribe to the blog to support me, and receive a bi-monthly-ish e-mail notification on my latest articles.   
  

Comments

Tags: