Best way to make a large text file?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Olyrd
Posts: 25
Joined: 05 Feb 2016 07:36

Best way to make a large text file?

#1 Post by Olyrd » 11 Apr 2016 10:47

What would be the simplest way to make a large text file (>60MB) filled with random data (words, letters, logs, anything)? I'm not looking to create fake sparse files. I need a way to make massive ammounts of useless random text to be outputted in a .txt file.

At first I was going to use WEVTUtil query-events Security /rd:true /format:text > eventlog.txt but turns out it's not enough (only 31MB of data). I'm looking for better ideas.

Also, if it could be a one-liner, it would be awesome.
Any thoughts guys?

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: Best way to make a large text file?

#2 Post by Squashman » 11 Apr 2016 11:29

Two ways that I know of but neither of these are by no means random.

1) Use FSUTIL.

Code: Select all

fsutil file createnew C:\testfile.txt 1000

This just creates an empty file with a bunch of carriage returns and line feeds.

2) This one just creates a file with the same character repeated several times which I got from Dave many years ago for doing Binary Compares.

Code: Select all

::Build a dummy file with length 32kbytes to do a binary compare with
::This file could be made larger or smaller, depending on requirements
<nul set /p ".=A" >dummy.txt
for /l %%n in (1 1 15) do type dummy.txt >>dummy.txt

You could make it a bit more random looking by changing the SET /P command.

Code: Select all

<nul set /p ".=AZM#$1903" >dummy.txt

miskox
Posts: 630
Joined: 28 Jun 2010 03:46

Re: Best way to make a large text file?

#3 Post by miskox » 11 Apr 2016 12:21

You need something like this: http://www.lipsum.com/

Saso

Olyrd
Posts: 25
Joined: 05 Feb 2016 07:36

Re: Best way to make a large text file?

#4 Post by Olyrd » 11 Apr 2016 14:03

You need something like this: http://www.lipsum.com/

That would be great for tests but I needed something directly in batch.

Two ways that I know of but neither of these are by no means random.
2) This one just creates a file with the same character repeated several times which I got from Dave many years ago for doing Binary Compares.

That one is superb.
Thank you so much.

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Best way to make a large text file?

#5 Post by penpen » 11 Apr 2016 17:05

Olyrd wrote:At first I was going to use WEVTUtil query-events Security /rd:true /format:text > eventlog.txt but turns out it's not enough (only 31MB of data). I'm looking for better ideas.
You may execute this command twice, and redirect all output:

Code: Select all

> "eventlog.txt" (
   WEVTUtil query-events Security /rd:true /format:text
   WEVTUtil query-events Security /rd:true /format:text
)
This should be 62 MB of data (if it always produces the same size).


penpen

miskox
Posts: 630
Joined: 28 Jun 2010 03:46

Re: Best way to make a large text file?

#6 Post by miskox » 14 Apr 2016 03:08

Here is a .bat file to generate such random text files.

http://www.howtogeek.com/137039/how-to- ... rish-text/

Saso

Post Reply