O'Reilly logo

Pro Windows PowerShell by Hristo Deshev

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

15.2. Writing Content

As we already mentioned, Get-Content has a symmetric cmdlet that performs the opposite action. It is called Set-Content, and it takes two parameters: -Value, which contains the object to be written to the file, and -Path, which holds the path to the file. The -Value parameter can be taken from the input pipeline instead of being specified explicitly. I have mentioned that it contains the object to be written to the file; this can be any object or a collection. If you pass an object, its built-in ToString() method will be called to get the string representation that will be stored to the file. If you pass a collection, it will be enumerated and all its members will be treated in manner that applies for a single object. To ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required