Skip to main content

Powershell: Get-Content - tail command on Windows

Love tail command on Linux? Try Get-Content with Powershell 3.0+.

Powershell Get-Content

Example: Keep reading the last 20 lines from C:\Windows\WindowsUpdate.log file

PS C:\> Get-Content C:\Windows\WindowsUpdate.log -Tail 20 -Wait
Read 20 last line from C:\Windows\WindowsUpdate.log file
Read 20 last line from C:\Windows\WindowsUpdate.log file

Count how many lines in a text file

PS C:\> (Get-Content C:\Windows\WindowsUpdate.log).Count

Popular posts from this blog

IIS: Delete cached files on server running IIS

Delete cached files on server running IIS When changing css, javascript files, check to delete if IIS still caches old files in the default folder C:\inetpub\temp\IIS Temporary Compressed Files\<sitename>\$^_gzip_D^\ Apply to: IIS 8.5

Viber: Notes

Wireguard VPN: Notes

Notes while trying Wireguard VPN on some of my testbeds.