我无法使用您的“force-copy.ps1”脚本将文件从有坏扇区的驱动器复制到健康的驱动器,当我尝试复制时出现以下情况:-
PS C:\Users\ACER\desktop> .\Force-Copy.ps1 -SourceFilePath "J:\All Pictures In This Computer\New folder\FileBrowser\Videos\VID_20170619_155259.mp4" DestinationFilePath "C:\Users\ACER\Desktop"
C:\Users\ACER\desktop\Force-Copy.ps1 : Cannot process argument transformation on parameter 'BufferSize'. Cannot
convert value "C:\Users\ACER\Desktop" to type "System.Int32". Error: "Input string was not in a correct format."
At line:1 char:143
+ ... \VID_20170619_155259.mp4" DestinationFilePath "C:\Users\ACER\Desktop"
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Force-Copy.ps1], ParameterBindingArgumentTransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Force-Copy.ps1
答案1
查看您如何调用脚本:
.\Force-Copy.ps1 -SourceFilePath "J:\All Pictures In This Computer\New folder\FileBrowser\Videos\VID_20170619_155259.mp4" DestinationFilePath "C:\Users\ACER\Desktop"
我认为您可能之前缺少连字符 (-) DestinationFilePath
,并且它将其解释为变量,而不是标志。您可以尝试:
.\Force-Copy.ps1 -SourceFilePath "J:\All Pictures In This Computer\New folder\FileBrowser\Videos\VID_20170619_155259.mp4" -DestinationFilePath "C:\Users\ACER\Desktop"