My Technical Notes

Friday, 18 March 2016

Waiting a File using PowerShell

Summary

PowerShell now supports waiting on a file out of the box with the `Get-Command` (aliased to `gc`) with the `Wait` switch and optionally include the `Tail` to only include the last `n` lines.

Example

Below is an example of how to wait on a log file:


gc C:\TEMP\log.txt -Wait -Tail 0

No comments: