
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Count Total Number of Lines in a File using PowerShell
To count the total number of lines in the file in PowerShell, you first need to retrieve the content of the item using Get-Content cmdlet and need to use method Length() to retrieve the total number of lines. An example is shown below.
Example
(Get-Content D:\Temp\PowerShellcommands.csv).Length
Output
PS C:\WINDOWS\system32> (Get-Content D:\Temp\PowerShellcommands.csv).Length 5727
Advertisements