Powershell Start-Process运行具有更多历史记录的另一个Powershell脚本

时间:2016-12-19 04:29:27

标签: powershell start-process

使用Start-Process我可以在我的powershell脚本中调用另一个powershell脚本。

e.g。 Start-Process powershell -argument '.\Another.ps1

问题是新窗口只有有限的历史记录(即向上滚动以查看打印出来的内容)

有没有办法从Start-Process增加历史记录大小?

如果没有,您如何调用另一个可以具有更多历史记录大小的powershell脚本?

1 个答案:

答案 0 :(得分:0)

在这种情况下,您可以针对该特定会话增加 MaximumHistoryCount

  

Get-Variable MaximumHistoryCount | Select-Object -ExpandProperty   属性

您可以设置最大值。

Set-Variable -Name MaximumHistoryCount -Value 32767
## Check it again using the range also 
Get-Variable -Name MaximumHistoryCount | Select-Object -ExpandProperty attributes | Format-List -Property *Range

注意:您不能为 32767 提供值。这是上限。

希望这有帮助。