In the same vein as Quickly create a large file on a Linux system, I\'d like to quickly create a large file on a Windows system. By large I\'m thinking 5 GB.
... 1 MB file dummy.txt within few seconds.
echo "This is just a sample line appended to create a big file.. " > dummy.txt for /L %i in (1,1,14) do type dummy.txt >> dummy.txt
See here : http://www.windows-commandline.com/how-to-create-large-dummy-file/
Check the Windows Server 2003 Resource Kit Tools. There is a utility called Creatfil.
 CREATFIL.EXE
 -? : This message
 -FileName -- name of the new file
 -FileSize -- size of file in KBytes, default is 1024 KBytes
It is the similar to mkfile on Solaris.
fsutil file createnew <filename> <length>
where <length> is in bytes.
fsutil requires administrative privileges though.
Short of writing a full application, us Python guys can achieve files of any size with four lines, same snippet on Windows and Linux (the os.stat() line is just a check):
>>> f = open('myfile.txt','w')
>>> f.seek(1024-1) # an example, pick any size
>>> f.write('\x00')
>>> f.close()
>>> os.stat('myfile.txt').st_size
1024L
>>>
Use:
/*
Creates an empty file, which can take all of the disk
space. Just specify the desired file size on the
command line.
*/
#include <windows.h>
#include <stdlib.h>
int main (int argc, char* ARGV[])
{
    int size;
    size = atoi(ARGV[1]);
    const char* full = "fulldisk.dsk";
    HANDLE hf = CreateFile(full,
                           GENERIC_WRITE,
                           0,
                           0,
                           CREATE_ALWAYS,
                           0,
                           0);
    SetFilePointer(hf, size, 0, FILE_BEGIN);
    SetEndOfFile(hf);
    CloseHandle(hf);
    return 0;
}
Plain ol' C... this builds under MinGW GCC on Windows XX and should work on any 'generic' C platform.
It generates a null file of a specified size. The resultant file is NOT just a directory space-occupier entry, and in fact occupies the specified number of bytes. This is fast because no actual writes occur except for the byte written before close.
My instance produces a file full of zeros - this could vary by platform; this program essentially sets up the directory structure for whatever data is hanging around.
#include <stdio.h>
#include <stdlib.h>
FILE *file;
int main(int argc, char **argv)
{
    unsigned long  size;
    if(argc!=3)
    {
        printf("Error ... syntax: Fillerfile  size  Fname \n\n");
        exit(1);
    }
    size = atoi(&*argv[1]);
    printf("Creating %d byte file '%s'...\n", size, &*argv[2]);
    if(!(file = fopen(&*argv[2], "w+")))
    {
        printf("Error opening file %s!\n\n", &*argv[2]);
        exit(1);
    }
    fseek(file, size-1, SEEK_SET);
    fprintf(file, "%c", 0x00);
    fclose(file);
}