Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Add-Content vs Out-File

$
0
0

I've been extracting text from files using get-content then .indexof to find content I'm interesting in, and there are two commands which enable me to then create a text file as output: Add-Content and Out-File. They do much the same thing but with differences. For example, Add-Content creates ascii files by default, and Out-File little-endian unicode. This results in an empty file containing nothing with Add-Content, and Hex FFFE with Out-File.

Why are there two commands to do such similar work so subtly differently, and under what circumstances do people choose one method rather than the other?

Any ideas?!

Cheers

Jay


Viewing all articles
Browse latest Browse all 6937

Trending Articles