【发布时间】:2014-07-31 11:34:45
【问题描述】:
最近我不得不在PowerShell 脚本中添加一个中间变量,否则New-Item 结果将成为函数结果的一部分:
# Put in local varible, otherwise we will return it as part of the function result
$Local:logDirectory = New-Item -ItemType directory -Path $Local:logDir
Write-Host "Created directory '$Local:logDir'"
}
return "$Local:logDir\$LogFileName"
在调试时,我希望能够转储(Write-Host 或其他东西)函数已经排队等待函数返回时在管道中结束的当前位。
所以:
在 PowerShell 函数中,如何查看到目前为止将返回到管道的结果
【问题讨论】:
-
我认为您所要求的(已在函数中输出到管道的项目的视图)不可用。
标签: powershell powershell-2.0 powershell-3.0