Use Get-Content and Get-Item in Powershell
Looking for the tail command on Windows? Get-Content will do the trick. Here’s a link to the command page.
Open PowerShell:
Show the last line/s:
Get-Content C:\inetpub\logs\LogFiles\W3SVC1\u_ex200711.log -Tail 1
Or use get-item
Get-Item -Path .\LineNumbers.txt | Get-Content -Tail 1
Stream the file like tail -f
Get-Content path-to-file -wait Example:
Get-Content C:\inetpub\logs\LogFiles\W3SVC1\u_ex210129.log -wait
Other examples of Get-Content
See first five lines:
Get-Content -Path .\LineNumbers.txt -TotalCount 5
or use a direct path
Get-Content C:\inetpub\logs\LogFiles\W3SVC1\u_ex200711.log -TotalCount 20
Grab a specific line #:
(Get-Content -Path .\LineNumbers.txt -TotalCount 25)[-1]