/ / / / / 3 Ways to Create Dummy Test File of Any Size in Windows 10

3 Ways to Create Dummy Test File of Any Size in Windows 10

If you want to test internet bandwidth (upload and download speeds) or disk read/write performance, you do not need to find and copy/move large files in Windows 10. Windows 10 can create a dummy test file of any size for you.

We bring you 3 ways through which you can create a dummy file of any size, at any location within your storage spaces, with any extension (file type) of your choosing. Continue reading the article to learn how to do so using just the Command-Line.

Dummy file requirements

You must first decide what type of dummy files you require. Here, you need to focus on 3 aspects:

  • Whether it needs to be an empty dummy file or one with legitimate information.
  • The size of the dummy file.
  • Type of dummy file, i.e. .txt, .jpg, .png, etc.

Once decided, you can continue down to the method of creating a dummy file that suits your needs.

Note that all of these methods create a single dummy file at a time. Therefore, you might need to run the same command multiple tiles to create any number for the files.

Moreover, one of the methods creates dummy files of any specified size but are empty, while the other one creates a dummy file of any size with legitimate content. Choose the one that best suits your needs.

How to create a dummy test file of any size in Windows 10

You can now continue to create as many dummy test files as your storage space allows. Choose any of the following methods to fulfill your needs.

Create an empty dummy test file of any size using Command Prompt

This method involves using a built-in utility in Windows 10 known as Fsutil. Fsutil is a powerful command-line utility used to perform tasks relating to the File Allocation Table (FAT) and the NTFS file system. If not used carefully, it can be fatal for your operating system. Therefore, we recommend that you create a restore point before moving forward.

Follow the steps below to create dummy files:

To create empty dummy files of any size or type, launch the Command Prompt with administrative privileges. Now modify the command given below as per your requirement and execute within Command Prompt.

fsutil file createnew "FilePath\FileName.FileType" FileSize

There are several variables in the command above. Replace FilePath with the path to the location where you wish to create the dummy file, replace FileName with its name, and replace FileType with the type of file you wish to create, such as .jpg, .txt, etc.

You also need to replace FileSize with the specific size of the file you want it to be. Remember that this number is in bytes. If you want to create a file with a 100 MB size, your FileSize will be 104857600 (100 x 1024 x 1024). If you wish to create a 1 GB file, then put the number 1073741824 (1 x 1024 x 1024 x 1024). Here is a list of different sizes converted into bytes for your convenience:

  • 1 MB = 1048576 bytes
  • 100 MB = 104857600 bytes
  • 1 GB = 1073741824 bytes
  • 10 GB = 10737418240 bytes
  • 100 GB =107374182400 bytes
  • 1 TB = 1099511627776 bytes
  • 10 TB =10995116277760 bytes

An example of a command for a 100 MB text dummy file we have created:

fsutil file createnew "c:\users\subhan\desktop\DummyTextFile1.txt" 104857600
cmd 1 1

You can now check that the file created is, in fact, the same size that you intended it to be through its properties.

properties 5

We have successfully created a dummy text file of our preferred size. You can do the same, and then repeat the command with different file names to create multiple dummy files.

Create dummy test file of any size with content using Command Prompt

Using this method, you can also put content within dummy text files to imitate real and legitimate data and test them out. This approach is somewhat different from the one mentioned above but still does the trick. Follow the steps below.

Launch Command Prompt with administrative privileges and use the following command to create a file with real values in it and execute it.

echo EnterText > FilePath\FileName.FileType

You need to replace EnterText with the real data that you wish to put into the dummy file. Remember that this text defines the initial size of the file which is very critical for further steps.

Also, replace FilePath with the path to the location where you wish to create the dummy file, replace FileName with its name, and replace FileType with the type of file you wish to create. Since you will be entering text, the FileType needs to be .txt, .docx, etc.

Here is an example of the file we created:

cmd 2 1

You can check that the data has been incorporated within the dummy file.

text file with context

You now need to check size your file that has been created. Putting “real data in dummy file” creates a text file of 28 bytes only. This will vary based on the length of the content you put in the file.

28 bytes

For easier calculation (which will be required in the steps below), we recommend that you enter “This is just a sample line appended to create a big file.. ” which comes out to be 64 bytes.

You now need to multiply this file and concatenate the same data to the existing file to reach the end goal for the file size. For that, we shall be using the command below. Remember to close the dummy file if you opened it previously.

for /L %i in (1,1,Multiple) do type FilePath\FileName.FileType >> FilePath\FileName.FileType

The first thing to change in the command above is the FilePath, FileName, and the FileType in 2 places. Note that these need to be the same as in the first command executed above so that the size is merged into one.

Secondly, you need to replace Multiple with an integer to double the size of the file with each loop. For example, putting 2 in place of Multiple would increase the file size to 128 bytes. However, putting 3 would increase it to 224 bytes. As you can see, increasing a single integer doubles the size of the file. You can use the formula below to calculate the value of Multiple:

FinalFileSize = SizeOfInitialFile x (2Multiple)

Here we have an example of creating a file with a size of 64 MB.

for /L %i in (1,1,21) do type c:\users\subhan\desktop\DummyFileWithContent.txt >> c:\users\subhan\desktop\DummyFileWithContent.txt
64

You will need to alter the variables by making a few calculations to get your desired size of the file with real data in it.

Create an empty dummy test file of any size using PowerShell

Windows PowerShell takes command-line authority a step further than the Command Prompt. You can use this as well to create empty dummy test files of any size. Here is how to do so:

Launch Windows PowerShell with administrative privileges and use the following command while replacing the necessary information to create a dummy file of a size of your choice:

$out = new-object byte[] FileSize; (new-object Random).NextBytes($out); [IO.File]::WriteAllBytes('FilePath\FileName.FileType', $out)

Replace FileSize with the size of the file you need to create (in bytes), FilePath with the location where you want to create it, FileName with the name of the file, and FileType with the type of dummy file you wish to create, such as .txt, .jpg, etc.

Here is an example of creating a .txt file on our desktop of 100 MB:

$out = new-object byte[] 104857600; (new-object Random).NextBytes($out); [IO.File]::WriteAllBytes('c:\users\subhan\desktop\PSDummyFile.txt', $out)
PS

You can check the size of the file created through its properties.

properties2

Closing words

Two out of the three methods can be used to create dummy test files that are empty, whereas one of the methods is used to create test files with real data inside them. That particular method can seem a bit tricky at first, but you can use the guide provided to create them easily.

Developers often inquire about where they can get dummy test files to check their programs and applications. This eliminates the hassle of you looking around and creating them yourself in a few easy steps.

Also see:

Leave a Reply

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