2014-07-04 111 views
0

我是PowerShell的新手,所以我可能错过了一些简单的事情。我正在尝试运行Start-PsFCIVoutlined here的文件校验和。Powershell:FCIV脚本错误:“找不到路径,因为它不存在”

我的尝试是在下面,我也试过排除-Path参数,以及使用相对/绝对路径。

PS C:\Users\Lucas\Downloads> Start-PsFCIV -Path C:\Users\Lucas\Downloads\DXSDK_Jun10.exe -HashAlgorithm SHA1 
Set-Location : Cannot find path 'C:\Users\Lucas\Downloads\DXSDK_Jun10.exe' because it does not exist. 
At C:\Scripts\PsFCIV_2.5.ps1:227 char:3 
+   Set-Location -LiteralPath $path 
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : ObjectNotFound: (C:\Users\Lucas\Downloads\DXSDK_Jun10.exe:String) [Set-Location], ItemNotFoundException 
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand 

Test-Path : Cannot bind argument to parameter 'LiteralPath' because it is an empty string. 
At C:\Scripts\PsFCIV_2.5.ps1:280 char:32 
+   if (!(Test-Path -LiteralPath $XML)) {return New-Object PsFCIV.FCIV} 
+          ~~~~ 
    + CategoryInfo   : InvalidData: (:) [Test-Path], ParameterBindingValidationException 
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.TestPathCommand 

__fromxml : Input XML file is not valid FCIV XML file. 
At C:\Scripts\PsFCIV_2.5.ps1:511 char:9 
+  $sum = __fromxml $xml 
+   ~~~~~~~~~~~~~~ 
    + CategoryInfo   : InvalidData: (:) [Write-Error], WriteErrorException 
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,__fromxml 

Exception setting "VerboseForegroundColor": "Cannot convert value "-1" to type "System.Windows.Media.Color". Error: "Invalid cast from 'System.ConsoleColor' to 'System.Windows.Media.Color'."" 
At C:\Scripts\PsFCIV_2.5.ps1:607 char:4 
+    $host.PrivateData.VerboseForegroundColor = $Host.UI.RawUI.ForegroundColor 
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : NotSpecified: (:) [], SetValueInvocationException 
    + FullyQualifiedErrorId : ExceptionWhenSetting 

You cannot call a method on a null-valued expression. 
At C:\Scripts\PsFCIV_2.5.ps1:612 char:4 
+    $sum.FILE_ENTRY.Add($entry) 
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : InvalidOperation: (:) [], RuntimeException 
    + FullyQualifiedErrorId : InvokeMethodOnNull 

Exception setting "VerboseForegroundColor": "Cannot convert value "-1" to type "System.Windows.Media.Color". Error: "Invalid cast from 'System.ConsoleColor' to 'System.Windows.Media.Color'."" 
At C:\Scripts\PsFCIV_2.5.ps1:607 char:4 
+    $host.PrivateData.VerboseForegroundColor = $Host.UI.RawUI.ForegroundColor 
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : NotSpecified: (:) [], SetValueInvocationException 
    + FullyQualifiedErrorId : ExceptionWhenSetting 

如何获得此命令的工作?在搜索15分钟后我找不到任何解决方案或类似问题。

回答

0

您得到的第一个异常是由Set-Location cmdlet抛出的,由于某些原因,它在Start-PsFCIV脚本中使用。 Set-Location期望一个文件夹作为它的参数-LiteralPath,但是您将其传递给一个文件。

根据"Useful Examples" on the PsFCIV webpage解决方案是使用-Include参数。例如:

Start-PsFCIV -Path C:\tmp -Include InstallPackage.msi -XML DB.XML -HashAlgorithm SHA512 
# Checks only InstallPackage.msi file in C:\tmp folder by using SHA512 hash algorithm. 
相关问题