Skip to content

Instantly share code, notes, and snippets.

@dublado
Created May 19, 2025 18:15
Show Gist options
  • Save dublado/a39fb7f48c39c22c9da6f54fb8c75b56 to your computer and use it in GitHub Desktop.
Save dublado/a39fb7f48c39c22c9da6f54fb8c75b56 to your computer and use it in GitHub Desktop.
tail for windows
@echo off
set file=%1
set lines=%2

if "%lines%"=="" (
  set lines=10
)

::powershell -NoProfile -Command "Get-Content %1 -TotalCount 10"
:: powershell -NoProfile -Command "Get-Content %1 | Select-Object -First 10"

powershell -NoProfile -Command "Get-Content '%file%' -Tail %lines%"
powershell -NoProfile -Command "Get-Content '%file%' -Wait -Tail 0"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment