首页 > 解决方案 > 让结果不再显示GAC信息

问题描述

我使用以下代码在powershell中运行ironpython代码,但输出结果总是显示GAC信息。看图片 在此处输入图像描述

[reflection.assembly]::LoadFrom("C:\Program Files\IronPython 2.7\IronPython.dll")
$py = [ironpython.hosting.python]::CreateEngine()
$py.Execute("print 'IronPython Engine loaded.'")

有什么办法可以隐藏吗?我不想每次都显示

标签: powershellironpython

解决方案


您可以将第一个命令通过管道传递给 Out-Null:

[reflection.assembly]::LoadFrom("C:\Program Files\IronPython 2.7\IronPython.dll") | Out-Null

$py = [ironpython.hosting.python]::CreateEngine() 
$py.Execute("print 'IronPython Engine loaded.'")

这会抑制命令的所有输出。

在此处输入图像描述


推荐阅读