.NET Framework - Any command like the tail -f from unix/linux to open log-files
Asked By Florian Broeder
21-Jun-07 10:10 AM
Hey Guys,
is there any command in Windows Powershell like the "tail -f <filename>"
command from unix/linux to open a log-file once an see the changes directly?
thanks for answers!
regards
florian
Microsoft.PowerShell.Commands.GetContentCommand
(1)
Microsoft.PowerShell.Management
(1)
Help.xmlPSSnapIn
(1)
RShell.Commands.Management.dllVerb
(1)
XP
(1)
PSSnapIn
(1)
ImplementingType
(1)
ErrorVariable
(1)
Hal Rottenberg replied...
Goooood question, I am also awaiting the answer from the experts.
gil.qi.zhan replied...
Hi, Florian:
Run "get-help get-eventlog -examples" in powershell. It shows 3
examples of get-eventlog. I suppose 2nd one maybe is what you want.
It's:
get-eventlog -newest 5 -logname application
This command displays the 5 most recent entries in the Application
event log.
BR.
Gil
Shafik replied...
try that:
Get-Content my.txt -Wait
Florian Broeder replied...
thanks, that´s it ;-)
florian
Hal Rottenberg replied...
And it is oddly undocumented. Where'd you find this?
Neil Chambers replied...
On 2007-06-22 12:06:56 +0100, Hal Rottenberg <halr9000@gmail.com> said:
I can't speak as to where Shafik picked it up, but I can tell you that
using MOW's fabulous TabCompletion (powertab:
http://thepowershellguy.com/blogs/posh/pages/powertab.aspx) will give
you a list of all availble options
get-content -<tab>
I can't recommend this PoSH add-on enough :-)
n
Kiron replied...
Also in 'Windows PowerShell in Action' p.313
--
Kiron
mc replied...

Not available in Win XP SP2 version of PowerShell:
PS C:\> get-command get-content| fl *
DLL :
C:\WINDOWS\assembly\GAC_MSIL\Microsoft.PowerShell.Commands.Management\1.0.0.0__31bf3856ad364e35\Micr
osoft.PowerShell.Commands.Management.dll
Verb : Get
Noun : Content
HelpFile : Microsoft.PowerShell.Commands.Management.dll-Help.xml
PSSnapIn : Microsoft.PowerShell.Management
ImplementingType : Microsoft.PowerShell.Commands.GetContentCommand
ParameterSets : {Path, LiteralPath}
Definition : Get-Content [-Path] <String[]> [-ReadCount <Int64>]
[-TotalCount <Int64>] [-Filter <String>] [-Inclu
de <String[]>] [-Exclude <String[]>] [-Force]
[-Credential <PSCredential>] [-Verbose] [-Debug] [-Err
orAction <ActionPreference>] [-ErrorVariable <String>]
[-OutVariable <String>] [-OutBuffer <Int32>]
Get-Content [-LiteralPath] <String[]> [-ReadCount
[-Include <String[]>] [-Exclude <String[]>] [-Force]
[-Credential <PSCredential>] [-Verbose] [-Debug
] [-ErrorAction <ActionPreference>] [-ErrorVariable
nt32>]
Name : Get-Content
CommandType : Cmdlet
--
.............. All new, all fresh ..............
http://www.leedesmond.com/weblog/
Keith Hill [MVP] replied...
Hmm, it is there on my XP SP2 system. I also notice that your output does not
include the -Encoding or the -Delimiter parameters.
--
Keith
mc replied...
Yes I noticed that too but was zooming in on the topic on hand (the -wait
parameter). Wonder what introduces the discrepency (missing 3rd party or
develpment tools, including the full .NET SDK)?
--
.............. All new, all fresh ..............
http://www.leedesmond.com/weblog/
erick calder replied to Shafik
forEach ($s in Get-Content my.txt -Wait) { echo $s }
doesn't work...
1).AddBusinessDays(2) http: / / cid-bb10621fcfe1bcf8.spaces.live.com / default.aspx Have fun. . . Powershell Discussions Microsoft.PowerShell.Commands.GetContentCommand (1) HitkL6DLUlvJFwxb (1) SonOfRFC1036 (1) FullyQualifiedErrorId (1) IsItDoneYet (1) NOfRFC1036 (1) Lighten up. The guy At line:1 char:5 + type <<<< pastebin.ps1 + CategoryInfo : OperationStopped: (:) [Get-Content], ParentContainsErrorRecordException + FullyQualifiedErrorId : ActionPreferenceStop, Microsoft.PowerShell.Commands.GetContentCommand Since I can't find anything or get anything myself it didn't strike me
fn -Force + CategoryInfo : ReadError: (D: \ Sandbox \ DM73. . .ListOffered.sql:String) [Get-Content], IOException + FullyQualifiedErrorId : GetContentReaderIOError, Microsoft.PowerShell.Commands.GetContentCommand Powershell Discussions GetContentReaderIOError (1) FullyQualifiedErrorId (1) CoordinatedAgencyID (1) SharedAgencyID (1) CategoryInfo (1) InvalidData (1) ReadError
line:1 char:50 + gc . \ RMQS_QS_DebugLog_20091019T090729.txt -split <<<< ":" + CategoryInfo : InvalidArgument: (:) [Get-Content], ParameterBindingException + FullyQualifiedErrorId : NamedParameterNotFound, Microsoft.PowerShell.Commands.GetContentCommand PS C: \ Sandbox \ DM72866 - RMQS route mode \ ServerCode \ RSEService \ bin \ debug> gc . \ RMQS_QS_DebugLog_20091019T090729.txt split line:1 char:3 + gc <<<< . \ RMQS_QS_DebugLog_20091019T090729.txt split ":" + CategoryInfo : InvalidArgument: (:) [Get-Content], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound, Microsoft.PowerShell.Commands.GetContentCommand PS C: \ Sandbox \ DM72866 - RMQS route mode \ ServerCode \ RSEService \ bin \ debug> gc . \ RMQS_QS_DebugLog_20091019T090729.txt | split