System.Uri不包含名为'new'的方法

Abh*_*hay 6 powershell system

[System.Uri]::new('http://www.stackoverflow.com') 失败并显示错误消息

[System.Uri]不包含名为'new'的方法

但是我能够在另一个盒子上找到这个方法.并运行良好.

如何查找PowerShell下加载的System对象之间是否存在差异

blu*_*uuf 10

您需要Powershell 5或更高版本才能使用.NET类的.ctor.在早期版本的Powershell中,您必须使用New-Object来执行此操作.