有没有办法强制 ISE 输出到控制台,而不是使用 Windows 表单?
例如:
$host.ui.PromptForChoice($title, $message, $options, 0)
在 ISE 中运行时,您会得到漂亮的表单版本。如果我只想在控制台中显示它,当我保存它并“使用 Powershell 运行”时它的运行方式怎么办?
只是希望能够在不离开 ISE 的情况下测试事物的外观。
最佳答案
您可以使用 [console]::writeline("testing")
将文本输出到 ISE 控制台工具窗口。但是 [console]::read*
方法真的不起作用。除此之外,您将受到主机如何实现 PSHostUserInterface
的摆布。接口(interface) - http://msdn.microsoft.com/en-us/library/system.management.automation.host.pshostuserinterface_members(v=vs.85).aspx
关于powershell - 在 ISE 中强制控制台输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26335117/