为什么Get-content支持-wait参数?

Nit*_*esh 1 parameters powershell powershell-2.0

在Powershell V2中获取Get-content的帮助时,我找不到-Wait参数.虽然我可以将此参数与相同的cmdlet一起使用.这不是常见的参数之一.

NAME
    Get-Content

SYNOPSIS
    Gets the content of the item at the specified location.

SYNTAX
    Get-Content [-LiteralPath] <string[]> [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Force
    ] [-Include <string[]>] [-ReadCount <Int64>] [-TotalCount <Int64>] [-UseTransaction] [<CommonParameters>]

    Get-Content [-Path] <string[]> [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Force] [-Inc
    lude <string[]>] [-ReadCount <Int64>] [-TotalCount <Int64>] [-UseTransaction] [<CommonParameters>]
Run Code Online (Sandbox Code Playgroud)

唯一的命令行开关我可以找到在Powershell V2中明确提到-Wait参数的地方 Start-process

get-content调用是否在引擎盖下启动?如何在Get-content中使用-Wait参数?

这可能有助于发现"帮助"中未提及的其他参数,但可以与该cmdlet一起使用.在此先感谢您的帮助!

Fro*_* F. 5

PowerShell的更高版本中添加了此开关的文档.这是来自PS 4.0.

PS > Get-Help Get-Content -Parameter wait

-Wait [<SwitchParameter>]
    Waits for the cmdlet to get the content before returning the command prompt. While waiting, Get-Content checks the
    file once each second until you interrupt it, such as by pressing CTRL+C.

    Wait is a dynamic parameter that the FileSystem provider adds to the Get-Content cmdlet. This parameter works only
    in file system drives.

    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Accept wildcard characters?  false
Run Code Online (Sandbox Code Playgroud)