2014-07-04 125 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. 
相關問題