powershell.exe-版本2.0正在冻结ISE&;控制台(版本4)

powershell.exe-版本2.0正在冻结ISE&;控制台(版本4),powershell,Powershell,我正在尝试在版本4.0中模拟powershell版本2.0 以下操作将冻结应用程序: PS H:\> powershell.exe -version 2.0 我确实得到了以下文本,但是控制台继续运行,我无法执行进一步的脚本 Windows PowerShell Copyright (C) 2009 Microsoft Corporation. All rights reserved. 据我所知,ISE中的命令窗口不是真正的控制台窗口。只是假装是。实际上,它在后台运行命令,并将输出复制

我正在尝试在版本4.0中模拟powershell版本2.0

以下操作将冻结应用程序:

PS H:\> powershell.exe -version 2.0
我确实得到了以下文本,但是控制台继续运行,我无法执行进一步的脚本

Windows PowerShell 
Copyright (C) 2009 Microsoft Corporation. All rights reserved.

据我所知,ISE中的命令窗口不是真正的控制台窗口。只是假装是。实际上,它在后台运行命令,并将输出复制到命令窗口

请注意,当您尝试运行
cmd.exe
时,会得到以下结果:

Cannot start "cmd". Interactive console applications are not supported. 
To run the application, use the Start-Process cmdlet or use "Start PowerShell.exe" from the File menu.
To view/modify the list of blocked console applications, use $psUnsupportedConsoleApplications, or consult online help.
At line:0 char:0
类似地,单独运行
powershell.exe
可以得到以下结果:

Cannot start "powershell". Interactive console applications are not supported. 
To run the application, use the Start-Process cmdlet or use "Start PowerShell.exe" from the File menu.
To view/modify the list of blocked console applications, use $psUnsupportedConsoleApplications, or consult online help.
At line:0 char:0
我不知道为什么
powershell-2.0版能工作。ISE肯定认为你在非交互地调用它

请注意,它不是冰冻的。它正在等待过程结束。您可以通过按Ctrl+C来结束它


使用
Start Process powershell.exe-ArgumentList“-Version 2.0”
打开一个新的控制台窗口。

ISE中的版本3也会出现这种情况(因此尝试从ISE中下载一个版本)。我认为这可能是一个bug,或者ISE3和ISE4不支持下版本的“功能”。另一种选择是,您可以始终使用PS控制台。太棒了-我刚刚发现run脚本左侧有一个按钮4,它也会打开powershell.exe。感谢您的精彩解释和片段。