我想模拟PowerShell 3.0
在PowerShell v3或v4中,您可以使用以下命令模拟v2:
%windir%\system32\WindowsPowerShell\v1.0\PowerShell.exe -version 2
$ Host显示:版本:2.0
但是,在PowerShell 4中
%windir%\system32\WindowsPowerShell\v1.0\PowerShell.exe -version 3
$ Host现在报告:版本:4.0(我希望输入3:0)
问题:有什么方法可以从4.0模拟PowerShell 3.0?
不,不可能。V4向后兼容V3,因此任何针对V3编写的脚本都可以在V4上正常工作。
如果要编写同时支持V3和V4的脚本,最好使用安装了V3的计算机/ VM,以确保您不依赖V4功能。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句