powershell write to file code example
Example 1: powershell write to file
Add-Content FilePath TextAdded
Example 2: powershell new file
New-Item -Path . -Name "testfile1.txt" -ItemType "file" -Value "This is a text string."
Example 3: powershell append to file
Add-Content c:\scripts\test.txt "The End"
Example 4: powershell output to file
ls | Out-File -FilePath c:\PATH\TO\FOLDER\OUTPUT.txt