line count in txt file

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 11 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
StupidSexyFlanders
Posts: 107
Last visit: Thu Apr 29, 2021 8:47 am

line count in txt file

Post by StupidSexyFlanders »

I have a two text files. One has 25 lines, the other has 1 line. Let's call them $big and $small, respectively.

This returns the correct results:
PS C:>(Get-Content $big).count
PS C:>25

But this returns no results:
PS C:>(Get-Content $small).count

Why is the single line file not being seen as such?
Mike
StupidSexyFlanders
Posts: 107
Last visit: Thu Apr 29, 2021 8:47 am

line count in txt file

Post by StupidSexyFlanders »

I have a two text files. One has 25 lines, the other has 1 line. Let's call them $big and $small, respectively.

This returns the correct results:
PS C:>(Get-Content $big).count
PS C:>25

But this returns no results:
PS C:>(Get-Content $small).count

Why is the single line file not being seen as such?
Mike
This topic is 11 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked