0
我正在运行一个问题我似乎无法使用通过PowerShell社区扩展(v2.0.3782.38614)提供的Read-Archive cmdlet )。PowerShell PSCX读取存档:无法绑定参数...问题
这里是用来表现我遇到的问题砍下样本:
$mainPath = "p:\temp"
$dest = Join-Path $mainPath "ps\CenCodes.zip"
Read-Archive -Path $dest -Format zip
运行上面产生以下错误:
Read-Archive : Cannot bind parameter 'Path'. Cannot convert the "p:\temp\ps\CenCodes.zip" value of type "System.String" to type "Pscx.IO.PscxPathInfo".
At line:3 char:19
+ Read-Archive -Path <<<< $dest -Format zip
+ CategoryInfo : InvalidArgument: (:) [Read-Archive], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Pscx.Commands.IO.Compression.ReadArchiveCommand
如果我不使用Join-建立传递到“读 - 存档”的路径的途径如下例所示:
$mainPath = "p:\temp"
$path = $mainPath + "\ps\CenCodes.zip"
Read-Archive -Path $path -Format zip
从以上:
ZIP Folder: CenCodes.zip#\
Index LastWriteTime Size Ratio Name ----- ------------- ---- ----- ----
0 6/17/2010 2:03 AM 3009106 24.53 % CenCodes.xls
更加混乱的,如果我的比较结果为上述两个读存档样品中的路径参数传递的两个变量,他们似乎相同:
这...
Write-Host "dest=$dest"
Write-Host "path=$path"
Write-Host ("path -eq dest is " + ($dest -eq $path).ToString())
输出...
dest=p:\temp\ps\CenCodes.zip
path=p:\temp\ps\CenCodes.zip
path -eq dest is True
任何人有任何想法,为什么第一个样本抱怨但S第二个工作正常吗?