Skip to content

Instantly share code, notes, and snippets.

@froop
Created May 1, 2022 08:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save froop/76e276748b7f75264c881790b0a8a397 to your computer and use it in GitHub Desktop.
Save froop/76e276748b7f75264c881790b0a8a397 to your computer and use it in GitHub Desktop.
[Windows][PowerShell] 大量行テキスト出力
[string]$FilePath = 'C:\work\dummy10m.txt'
[long]$FileSize = 10485760
$ErrorActionPreference = 'Stop'
Add-type -AssemblyName System.Web
[long]$WriteSize = 0
$file = New-Object System.IO.StreamWriter($FilePath, $false)
while($WriteSize -lt $FileSize){
$String = "this is dummy row`r`n"
$file.Write($String)
$WriteSize = $WriteSize + $String.Length
}
$file.Close()
# [参考]
# 【Windows】ダミーファイルを任意のサイズで作成する | とあるオタクの徒然日記
# https://tsuredurediary.com/archives/windows-dummy-file.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment