Mike Kaney said:
Hi all,
Was wondering if anyone knows the command in WinXP command shell to create
a file of a specified type and size? I have searched the internet and this
group, and found nothing. I know there is one because I have used it
before. Any help would be appreciated.
I remeber also such command, but not as an integrated in XP. It was
a tool to create diskfiles for harddisk tests.
You can create files with defined size by using some for loops and
appending output to a file.
Keep in mind that you can create a file with any name and extension but
some filetypes require an inner structure which you can't easily/at all
resemble this way.
To start with the for command for /?
FOR /L %Variable IN (Start,Step,End) DO command [parameters]
=========creatfil.cmd============
@echo off & setlocal enableextensions
:: expects 3 parameters filename, blocksize, numblocks (no testing)
set fil=%1
:: to keep it simple we will echo 30 chars per line plus two cr/lf
:: so blocksize 32 gives one Kilobyte with 1024 byte
set blocksize=%2
:: block size in extends of 32
set numblocks=%3
:: number of blocks to generate
del %fil%
for /L %%A IN (1,1,%numblocks%) do (
for /L %%B IN (1,1,%blocksize%) do (
echo/123456789012345678901234567890>>%fil%))
dir %fil%
====================================