Home > Command Line, Windows XP > Create file of a certain size

Create file of a certain size

October 13th, 2008 Leave a comment Go to comments

Every now and then I find myself needing to create a file of a certain size for one reason or another. This is usually for testing in situations where people are experiencing email attachment issues or disk quota problems, things like that. The quickest way to do this is to use a Windows command line utility called fsutil.exe. This command line tool can be used (amongst other things) for quota management, system info enumeration and some basic file manipulation.

I recently used the following approach to create a file 5MB in size to prove that email statistics were correctly being generated. This command produces a new file called '5mb-file.txt' on the root of the c:\ drive:

fsutil file createnew C:\5mb-file.txt 5000000

The number at the end of the command is the file size in bytes. So the result is a file just under 5mb in size.

Categories: Command Line, Windows XP Tags:
  1. No comments yet.

*

code