Let me preface this by saying I'm completely new to Powershell and I'm not too familiar with the language.
I'm looking to create a simple script that will count the lines of a text file and then return the result as an integer. This is the code I have so far:
$lines = Get-Content -Path "C:\File" | Measure-Object -Line
and it returns the following:
Lines Words Characters Property
----- ----- ---------- --------
8
However, I'm looking to return the 8 as a single integer so it can be stored as a variable. Is there an easy way to do this? I appreciate any help.
Thank you!