Powershell命令行日志 - 什么是'提示'

时间:2016-05-28 14:17:23

标签: powershell logging

为powershell提取命令行日志,我们添加了变量

#$LogCommandHealthEvent = $true
#$LogCommandLifeCycleEvent = $true

它的效果很好但是什么是'提示'

Time                 Event Command    
----                 ----- -------    
5/27/2016 1:38:31 PM   501 prompt     
5/27/2016 1:38:31 PM   500 prompt     
5/27/2016 1:38:31 PM   501 get-process
5/27/2016 1:38:31 PM   500 get-process
5/27/2016 1:38:29 PM   501 prompt     
5/27/2016 1:38:29 PM   500 prompt     
5/27/2016 1:38:29 PM   501 ipconfig   

这确实出现在日志中的eventdata中 - faa69d45087e PipelineId = 608 CommandName = prompt CommandType = Function ScriptName = CommandPath = CommandLine = prompt

1 个答案:

答案 0 :(得分:1)

来自About_Prompts

    The Prompt function determines the appearance of the Windows PowerShell 
    prompt. Windows PowerShell comes with a built-in Prompt function, but
    you can override it by defining your own Prompt function.

...

BUILT-IN PROMPT
    Windows PowerShell includes a built-in prompt function. 

    In Windows PowerShell 3.0, the built-in prompt function is:
    function prompt
    {
        "PS $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) "
    }

其他详情:

  1. 每次显示提示时都会调用提示函数以刷新提示中的任何详细信息(例如路径)。