O'Reilly logo

Windows PowerShell™ 2.0: Administrator’s Pocket Consultant by William R. Stanek

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

Working with File Contents

Often when you are working with computers, you’ll want to create your own configuration and inventory records or logs to record your activities. PowerShell makes this easy by providing a simple set of commands for reading the contents of files and writing new contents to files.

Commands for Managing File Contents

Commands that help you access file resources include the following:

  • Get-Content. Displays the contents of files in a specified location. Use –Force to force access to a hidden, system, or read-only file. Use –TotalCount to specify the number of lines in each matching file to display. Use –Include to limit the matches to files meeting specific criteria. Use –Exclude to omit specified files. Both –Include and –Exclude ...

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