Tail -f in windows

This is a simple PowerShell function that attempts to replicate the Unix command “tail -f”

The only downside is that it outputs from the beginning of the file until it reaches the end, then updates the output as new lines are added to the text file.

   Tail command for windows
   replicates the functionality of tail -f
   Usage: tail -filename sometextfile.txt
   a single text file
   Output to console
   The component this cmdlet belongs to
   The role this cmdlet belongs to
   Somewhat Replicates the tail -f function of Nix
function tail {
    param (
    $filecontent=Get-Content $filename

    $filecontent=Get-Content $filename

    (Get-Content $filename)[$startlength .. $currentlength]


Or you could simply do this with:

$filename = "sometext.txt"
Get-Content -Path $filename -Tail 8 -ReadCount 0 -Wait

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.