July 24th, 2013

PowerTip: Count Your PowerShell Scripts

Doctor Scripto
Scripter

Summary: Learn how to count how many PowerShell scripts you have written.

Hey, Scripting Guy! Question My boss asked me how many Windows PowerShell scripts I have written. I keep all my scripts in a specific folder. How can I use Windows PowerShell to count them?

Hey, Scripting Guy! Answer Use the Get-ChildItem cmdlet (dir is an alias), and specify the path, a filter, and the Recurse parameter; then pipe the results to the Measure-Object cmdlet:

dir -Path C:\data -Filter *.ps1 -Recurse | measure

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.

Feedback