powershell - 在 ISE 中强制控制台输出?

标签 powershell powershell-ise

有没有办法强制 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/

相关文章:

powershell - 将路径管道传递到测试路径时,PowerShell ISE “Illegal characters in path”?

performance - 提高检查文件定界符的性能

azure - 如何使用 Azure Powershell(不是 az cli)设置用户分配的标识?

powershell - 在 Powershell 中将文件内容与字符串进行比较

powershell - kubectl exec 命令在 powershell ISE 中不起作用(在 powershell 中起作用)- 是否有理由或解决方法使其起作用?

Powershell ISE 在(愚蠢地)删除所有变量后无法启动

python - Powershell 与 Python 中的不同 MD5 哈希结果

logging - Powershell 计划任务冲突?

powershell - AzureKeyVaultSecret 备份/导入 powershell 命令在哪里?

windows-7 - 用于显示通知气球并采取行动的 PowerShell 脚本仅适用于 ISE gui,而不适用于命令行