用 fsutil 秒建任意大小的测试文件

瞬间生成一个几 GB 的空文件,用来测试拷贝速度、存储或网络传输。

Windows文件命令提示符占位文件低风险
运行 `fsutil file createnew D:\Test\testfile.bin 1073741824`,几秒钟即可创建一个 1GB 的测试文件。

01命令

命令
$ fsutil file createnew D:\Test\testfile.bin 1073741824

02作用说明

fsutil file createnew 会按指定字节数直接分配一个文件(1073741824 字节 = 1GB),因为不写入实际数据,所以再大的文件也是瞬间生成。它常用来测试文件夹传输、U盘写入速度,或观察程序处理大文件时的表现。

03风险

风险低风险
使用条件Built into Windows; the byte size is required (e.g. 1073741824 = 1 GB).
!注意: 生成的文件里没有有效数据,只适合做容量和速度测试,不能当正常文件用。

04撤销

撤销
$ del D:\Test\testfile.bin

05来源

  • FSUtil — File system utilities
    SS64 · technical · 2026-09-17
    依据: Includes the FILE CREATENEW command that creates a new file of a given size.
  • fsutil file
    Microsoft Learn · vendor-doc · 2026-09-17
    依据: Documents "fsutil file createnew <filename> <length>" which creates a file of the specified name and size.

最后验证: 2026-09-19 · 分类: 文件与文件夹

06相关方案