2014-04-03 36 views
2

我的机器上安装了Powershell 3。我可以将Powershell 4与Powershell 3并排安装吗?

我需要使用PowerShell 4测试一些剧本,但我想继续运行一些我的脚本,Powershell的3下测试的,我不想通过安装PowerShell的4

问题碰坏:尽管我已经安装了Powershell 4,是否可以在Powershell版本3(甚至如果需要的话)下打开Powershell会话?

+0

看到这个几乎相同的问题:http://stackoverflow.com/questions/21554993/can-you-mimic-powershell-v3-once-you-have-installed-v4 –

回答

5

是。从V3开始,您可以使用-Version参数打开一个低级版本的PowerShell会话。

-Version 
    Starts the specified version of Windows PowerShell. 
    Enter a version number with the parameter, such as "-version 2.0". 

所以运行

Powershell.exe -Version 2 

将启动可用于运行/测试脚本V2会话。

+0

如果Windows PowerShell 3.0安装在计算机上,有效值是“2.0”和“3.0”。默认值是“3.0”。 如果未安装Windows PowerShell 3.0,则唯一有效值为“2.0”。其他值将被忽略。 –

+0

这实际上是做什么的?它是否真的运行指定的PS版本,或者这是否在新版本中实现了某种兼容模式? – jpmc26

相关问题