繁体   English   中英

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

[英]powershell.exe -version 2.0 is Freezing ISE & Console (Version 4)

我正在尝试在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可以使我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 -version 2.0可以工作。 ISE必须认为您是非交互式地调用它。

请注意,它没有冻结。 它正在等待过程结束。 您可以通过按Ctrl + C结束它。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM