Windows PowerShell 给我们提供了一系列的帮助,帮我们提高了工作效率、节约了大量的时间。但是有些时间,我们需要使用不同版本的Windows PowerShell,怎么办呢?难道说准备好几个机器?那如何是一个任务序列要使用不同版本怎么办?换机器不可能了吧,现在我们就来解决这个问题! 现在启动Windows PowerShell,如下图 
我们来看看我的Windows PowerShell版本是多少,如下图所示,我的是4.0 
大家都知道,PowerShell的主程序就叫powershell.exe,那我们直接打问号看看有没有什么参数,如下图所示,有很多参数 
我们这里举例不同版本的参数,version 现在我们来试试这个参数,比如我现在有个脚本,需要powershell 3.0环境,直接输入以下命令,我们就进入了此环境中,那2.0呢 
下图我尝试进入2.0环境,但是提示我机器上没有安装.NET 2.0,所以答案就是,Windows PowerShell 向下兼容,且必须安装有相对应的.NET 程序 
还在换机器的小伙伴们快试试吧!
此文出自东方瑞通李晓辉老师,转载需注明出处。
|