Powershell Tip #119: Increase the number of lines sent to pipeline with Get-Content

By | September 11, 2016

Tip: You can use the parameter ReadCount of Get-Content cmdlet to increase the number of lines sent to pipeline.

The default value is 1 (each line is sent to pipeline to the next command at a time).
The value 0 sends all of the content at one time (when working with large items, it can speed up the time it takes to process).
You could specify the value you want depending on your situation.

As a quick demo, I have a file “paths.txt” (64 MB) which contains all the files (FullName) of one computer.

parameter-readcount-get-content-speedup

Files generated are the same but we gained 24 seconds by using -ReadCount 0.

parameter-readcount-get-content-speedup-comparaison


previous-buttonnext-button

2 thoughts on “Powershell Tip #119: Increase the number of lines sent to pipeline with Get-Content

  1. Pingback: Powershell Tip #118: Test if path is a file or a folder using Test-Path cmdlet | Powershell Guru

  2. Pingback: Powershell Tip #120: List the headers of a CSV file | Powershell Guru

Leave a Reply

Your email address will not be published. Required fields are marked *