4 ways to create random dummy files with a specific size in Windows

While most regular users might have issues understanding the need to create random dummy files of a specific size, geeks, software developers, and power users know why such files can come in handy sometimes. You can use dummy files to figure out if there are any bad sectors on your hard drive, to test network speed, or to ensure that files on your computer or device are deleted beyond recovery. Regardless of your reasons, here are four ways to create such files in any modern version of Windows:

1. Create a dummy file with the fsutil command

All Windows versions since Vista include an executable named fsutil.exe. In Windows 10, you can find it in the "C:\Windows\System32" folder.

The folder containing the fsutil executable

Fsutil.exe is a powerful tool for managing partitions and volumes. Among many other things, you can also use it to quickly create dummy files of any size from the Command Prompt.

There are a lot of ways to launch the Command Prompt, but we prefer to enter "cmd" in our taskbar's search field, and then to click or tap on Command Prompt. If you intend to create random dummy files in a protected system folder (like your C: drive), press "Run as administrator" instead.

Open Command Prompt from your taskbar

Once the Command Prompt is open, type in fsutil and hit Enter to see a list of commands supported by this tool. There are many parameters that you can use. This only gives you a taste of what fsutil.exe can do. You can find complete information about its capabilities in its official documentation on TechNet.

The list of commands supported by fsutil

There are two commands you can enter in the Command Prompt to create a dummy file:

  • fsutil file createnew filename size
  • fsutil file createnew path\filename size

Replace filename with the name you want for the dummy file. You can choose to add an extension or not, as this does not affect the process. Replace size with the size you want your dummy file to have. The size is measured in bytes. It might be easier to use an online converter to help you define the size you prefer.

The difference between the two commands is that the second one allows you to specify exactly where your file is stored, by replacing path with a location of your choice on your device.

Now that we got over the theory part, let's see how this works in practice. We first created a file called myfile.exe with a size of 10MB or 10485760 bytes. To create it, we entered the following command: fsutil file createnew myfile.exe 10485760

Creating a file using the first command

As seen above, if you use the first command and do not specify a path, the file is created in your user profile folder. In our case, it was stored at C:\Users\Diana Ann Roe. We then created another 2MB file, this time using a specific path and no extension. We entered: fsutil file createnew D:\myfile 2097152

Creating a file using the second command

One aspect to note is that the files created with fsutil.exe are empty. There's no content inside.

2. Create a random dummy file with Dummy File Creator

If you want dummy files with random content, or if you are uncomfortable with the Command Prompt, then you should consider using third-party apps. A free and easy to use tool is the Dummy File Creator.

You can choose between the installer and an archive. We recommend you to get the archive and extract it somewhere on your computer. Then, run the Dummy.exe file. If you want to generate files on your system drive (C:), right-click or press-and-hold and select "Run as administrator," or the program returns an error when it tries to create your files.

Run Dummy.exe to start creating dummy files

While in need of a makeover, the interface of this program is straightforward. The Mode section lets you choose whether you want to generate one file or more. Use the Browse button to get to the location where you want to create the file(s) and type in the name (and extension, if you want one). Next, specify the File Size and check the "Random file content (non-compressible)" box if you want your file(s) to have random content. Then, click or tap Create.

Customize your dummy file(s) and press Create

A progress bar keeps you updated while your file is being created.

Follow the creation of your dummy file

As soon as the program finishes writing, you get a notification informing you that your file was created.

A pop-up lets you know the file was created

This tool is obviously easier to use than fsutil.exe, and it also comes with several advantages, like creating more files at the same time and the option to add random file content.

3. Create a random dummy file with Disk Tools

Another free alternative that provides more customization options is the Disk tools toolkit. As the name implies, this is a suite of small free disk-related tools. One of these tools is the File Generator. Download and run CubicDesign_tools.exe. When you try to access it, Windows Defender SmartScreen pops up, telling you that it prevented an unrecognized app from starting. Click or tap on More info and choose Run anyway. Click or tap Install and wait for the app to unpack. Once the extraction is complete, File Explorer takes you to the newly created folder called Tahionic tools package. Out of all the files included in this suite, open Disk Tools.exe, from the System & security folder.

Access Disk Tools.exe

Also in dire need of a makeover, the Disk Tools opens at the File generator tab, which is the one we need to create dummy files.

Use the File generator tab to create dummy files

The four sections in this tab help you customize your dummy file(s):

  • Number of files - Set the number of generated files.
  • File size - Set the file size or choose one of the suggested sizes on the right.
  • File name - Set the file name and location. Select Pattern to enter a custom name (and, optionally, an extension)
  • File content - Set the file content. Select "Fill the files with this content" to customize the text in your file and to unlock the option to "Make file unique," which comes in handy when you create multiple files, and you don't want generated files with identical content.

When you are done setting things up, click or tap Create. A beep signals that the dummy file was created, and, at the bottom of the tab, the program also lets you know the time it took to generate the file. It is possible for the program to beep and announce it has generated the dummy file, but the file is not at the specified location. This can happen if you are running Disk Tools without administrator permissions and you are trying to create files on your system drive (C:). To create files anywhere on your Windows computer or device, make sure to open the program as administrator.

What we liked about this app is that, although it looks a bit cluttered, it provides excellent configuration options, and you have a say when it comes to file content. The option to generate unique files is also a nice touch.

4. Create a random dummy file with PowerShell

You can also create a dummy file using PowerShell from Windows. While we detailed all the ways you can open this app in a previous tutorial, we find it easiest to type in "powershell" in the taskbar's search field, and then to click or tap on Windows PowerShell. However, if you plan to create random dummy files on your system drive (C:), make sure to select "Run as Administrator" from the options on the right when you open it.

Open PowerShell from your taskbar

The PowerShell app launches, waiting for you to type commands and run them.

The PowerShell console opens

To create a dummy file, you need to enter the following one-line command:

$out = new-object byte[] size; (new-object Random).NextBytes($out); [IO.File]::WriteAllBytes('path\filename', $out)

Replace size with the size your dummy file should have, in bytes. You can use an online converter if you need help defining the size you prefer. Replace path with the location where you want to create the dummy file. Replace filename with the name you want for the dummy file. Add a file extension if you want to, as this has no impact on the process. Let's illustrate this with an example to make it clearer:

We decided to create a file called mypowerfile.txt with a size of 1MB (or 1048576 bytes) on the D: partition. To create it, we entered the following command: $out = new-object byte[] 1048576; (new-object Random).NextBytes($out); [IO.File]::WriteAllBytes('D:\mypowerfile.txt', $out)

Create a dummy file using PowerShell

Although PowerShell does not offer real-time feedback (unless you made an error writing the command), like the other apps we went over, you can tell it is done creating the file when it is ready for another command. If you go to the specified location, you can see that the dummy file has been created.

The dummy file created with PowerShell

Similar to using fsutil in the Command Prompt, you can leave out the path and the file is created in your user profile folder. We used the same command as above, leaving out the path entirely: $out = new-object byte[] 1048576; (new-object Random).NextBytes($out); [IO.File]::WriteAllBytes('mypowerfile.txt', $out)

Create a dummy file without specifying the path

Without a path, the new dummy file is stored by default at C:\Users\YourUserName\mypowerfile.exe, as seen below. As opposed to fsutil, PowerShell lets you create dummy files with random content. If you compare two files, created using the same command, you can see that they have different content.

Files without a specified path are created in your user profile folder

Out of all the options above, PowerShell is the most complicated, both because of the complexity of its commands and the absence of confirmation when your dummy file is generated. However, power users might prefer it to the other options.

TIP: When using the PowerShell commands above, you can add a parameter that makes the console provide feedback, while creating dummy files. However, keep in mind that this makes the command unnecessarily long, as you have to insert the following one-liner:

$out = new-object byte[] 1048576; (new-object Random).NextBytes($out); [IO.File]::WriteAllBytes('mypowerfile.txt', $out); if ($out -ne $null) {Write-Host ("Dummy file successfully created")} else {"Failed to create dummy file"}

Which method do you find easiest?

We searched the pits of the internet and downloaded one too many suspicious files in order to bring you this tutorial. Before you close it, please let us know which of these methods do you prefer? Also, if you know other ways to create dummy files in Windows, don't hesitate to share them in the comments below and we promise to check them out.