Generate a large file with a single or repeating characters Windows command line, batch, or powershell?

You may use the following PowerShell command in a Command Prompt (CMD):

powershell -command "'1234567890'*107374183" > file.txt

This will duplicate the string "1234567890" for 107374183 times, creating a file of size 1073741830 bytes.


In your command line:

(@echo\1>>File.txt & @for /L %L in (1 1 28)do @copy/y /b .\File.txt .\TMP.txt >nul && @copy/y /b .\File.txt + .\TMP.txt .\File.txt >nul) && del .\tmp.txt

In your bat/cmd file:

@echo off && cd /d "drive:\path\to\file_create"

echo\1>>.\File.txt 

for /L %%L in (1 1 28)do >nul (
    copy/y /b .\File.txt .\TMP.txt
    copy/y /b .\File.txt + .\TMP.txt .\File.txt 
   )

del /q /f /a .\TMP.txt
  • Your new file File.txt and size 1.00 GB (1,073,741,824 bytes)

enter image description here