Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get-Content with wait parameter doesn't update in Powershell

Tags:

powershell

I'm trying to monitor a file using Get-Content $path -wait in Windows Powershell V3.0. Sometimes when I execute this command line in Powershell it will function as expected. But sometimes it will only execute (or at least it seems like) get-content but without the -wait parameter. Even though the file get's updated it won't be shown in Powershell. If I cancel the command and rerun it it will show the updated file content.

What do I need to do?

EDIT: It seems to update blocks after a while. But it's not real-time really.

like image 551
theknut Avatar asked Nov 12 '22 02:11

theknut


1 Answers

Not allowed to comment (don't have a 50 reputation), so have to give an Answer....

Less for Windows (http://gnuwin32.sourceforge.net/packages/less.htm) with the +F or Shift-F option (http://www.commandlinefu.com/commands/view/1024/make-less-behave-like-tail-f.) showed updated file content where PowerShell "get-content $path -wait" did not.

like image 117
Ronnie and Sandy Avatar answered Nov 14 '22 23:11

Ronnie and Sandy