Set-Contentis one of those core PowerShell cmdlets that I can’t do without. I still remember using VBscript before we could use PowerShell to write to a file. I remember always trying to remember what kind of object I needed to use and the method name. Was it FileSystemObject, FileObject or what? It was a pain! Also, even when I did recall the method name was
CreateTextFile, I’d always forget to add
Trueas the second argument.
Here’s an example of the monstrosity I’m talking about.
Click through to see how easy writing is with Powershell.