我的盒子上安装了Powershell 3。
我需要用Powershell 4测试一些脚本,但是我想继续运行一些在Powershell 3下测试的脚本,并且我不想通过安装Powershell 4破坏一些东西。
问题:尽管我已经安装了Powershell 4,但在Powershell第3版(如果需要的话,甚至是2)下是否可以打开Powershell会话?
发布于 2014-04-03 13:12:08
是。从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脚本的会话。
发布于 2014-04-03 13:10:47
安装了WindowsManagementFrameworkCore4.0包后,您可以运行PowerShell 2.0版本,但不能运行3.0。使用-version 2.0参数启动PowerShell v2。
参见这篇TechNet文章:http://technet.microsoft.com/en-us/library/hh847899.aspx
还请参阅help about_powershell.exe帮助文档:http://technet.microsoft.com/en-us/library/jj553275.aspx
https://stackoverflow.com/questions/22838469
复制相似问题