我正在使用Invoke-Expression
PowerShell 中的 cmdlet 来加载模块。
以下代码按预期工作。
$url="http://pastebin.com/raw/FuxtpN69"
IEX (New-Object System.Net.Webclient).DownloadString($url)
但是当我尝试使用变量来分割域和页面时。
$u="http://pastebin.com"
$rl="/raw/FuxtpN69"
$url="$u$rl"
IEX (New-Object System.Net.Webclient).DownloadString($url)
我收到以下路径错误:
Exception calling "DownloadString" with "1" argument(s): "The given path's format is not supported."
At line:8 char:53
+ IEX (New-Object System.Net.Webclient).DownloadString <<<< ($url)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
有人能帮我吗?提前致谢。