2022-05-10から1日間の記事一覧

powershell - file read/write - c

# read file, output contents $list = @() foreach ($line in @(gc -path "./test-utf8.txt" -Encoding UTF8)) { $list += ($line + "_add") } # write file sc -path "./test-utf8-add-c.txt" -Encoding UTF8 -Value $list

powershell - file read/write - b

# read file $lines = @(Get-Content -path "./test-utf8.txt" -Encoding UTF8) Write-Host $lines # output contents $list = @() foreach ($line in $lines) { $list += ($line + "_add") } # write file Set-Content -path "./test-utf8-add-b.txt" -Enco…

powershell - file read/write - a

# encoding $enc = [System.Text.Encoding]::UTF8 # read file $lines = [System.IO.File]::ReadAllLines("./test-utf8.txt", $enc) # output contents $list = New-Object System.Collections.Generic.list[string] foreach ($line in $lines) { $list.Add(…