Pages

Wednesday, June 15, 2022

Powershell Append or Add Text into File

Powershell Append or Add Text into File

- Without Get-Content

- Dynamic call/execute command


$text = "texthere"

$cmd = "Add-Content -Path C:\xxx.txt -Value ""$text"""

for ($i = 0; $i -lt 1000; $i++) { Invoke-Expression $cmd }

ShareThis