所以我试图从一台服务器复制44k文件到另一台。
我的Powershell脚本是:
Import-CSV f:\script\Listoffiles.csv | foreach $line {Move-item $_.Source $_.Destination}
使用CSV的格式:
Source, Destination E:\folder1\folder2\file with space.txt, \\1.2.3.4\folder1\folder2\file with space.txt
我不断收到:
A positional parameter cannot be found that accepts argument '\\1.2.3.4\folder1\folder2\file'. At line:1 char:10 + move-item <<<< E:\folder1\folder2\file with space.txt \\1.2.3.4\folder1\folder2\file with space.txt + CategoryInfo : InvalidArgument: (:) [Move-Item], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.MoveItemCommand
所以我试着把两个path放在一起,还有,我还是得到Move-Item: Could not find a part of the path错误Move-Item: Could not find a part of the path 。
谁能帮我?
你有没有试过把移动项目的参数而不是csv项目的引号? 另外,放下$ linevariables。
Import-CSV f:\script\Listoffiles.csv | foreach {Move-item "$_.Source" "$_.Destination"}