我正在执行以下代码,但在PowerShell 2.0中遇到错误,而代码在最新版本中工作正常,请帮助是否有任何Snapin解决此问题或除了更新PowerShell之外的任何其他解决方案。提前致谢。
Code:
Write-Output $a |Tee-Object -FilePath $fileName
Write-Output("Please wait components deletion is in progress")|Tee-Object -FilePath $fileName -Append
Error:
Tee-Object : A parameter cannot be found that matches parameter name 'Append'.
At line:1 char:102
+ Write-Output("Please wait components deletion is in progress")|Tee- Object -FilePath $fileName -Append
+ CategoryInfo : InvalidArgument: (:) [Tee-Object], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.TeeObjectCommand
这很简单。 Tee-object在PS 2.0中没有-Append
。甚至,MSDN页面提到了PS 3.0的这个cmdlet:https://technet.microsoft.com/en-us/library/hh849937(v=wps.640).aspx