Powershell创造大的虚拟文件


支持所有版本。

如果需要给系统压力测试或其它任务需要大的虚拟文件,下面一段代码能快速创造大的文件。

$Path = "$env:temp\hugefile.txt"
$Size = 200MB

$stream = New-Object System.IO.FileStream($Path, [System.IO.FileMode]::CreateNew)
$stream.Seek($Size, [System.IO.SeekOrigin]::Begin)
$stream.WriteByte(0)
$Stream.Close()

explorer.exe "/select,$Path" 

原文地址:Creating Huge Dummy Files

本文链接: https://www.pstips.net/creating-huge-dummy-files.html
请尊重原作者和编辑的辛勤劳动,欢迎转载,并注明出处!

发表评论

您的电子邮箱地址不会被公开。 必填项已用 * 标注