尝试执行 PowerShell 脚本时,我从 TeamCity 收到以下错误。
Illegal characters in path.
+ CategoryInfo : NotSpecified: (:) [Copy-Item], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Co
mmands.CopyItemCommand
下面是我正在调用的脚本块...
$xcopyFolderBlock =
{
$destFolder = ($args[0] | out-string)
$sourceFolder = $args[1]
# See what value was passed in to the script block
write-host "destFolder inside xcopyFolder code block: " $destFolder
write-host "sourceFolder inside xcopyFolder code block: " $sourceFolder
Copy-Item $sourceFolder $destFolder -force -recurse -verbose
}
我就是这样称呼它的...
Invoke-Command -ComputerName $web1Name -ScriptBlock $xcopyFolderBlock -ArgumentList(, $web1FolderServices, $nasFolderServices)
我的 TeamCity 日志显示来自脚本块中 write-host 调用的这些值......
destFolder inside xcopyFolder code block: \\\s1-bridge-web1\BridgeWebServices\Prod\MileageCalculator\v1.1.31\Services
sourceFolder inside xcopyFolder code block: \\\s1-nas-1\software_dev\build\Prod\build_user\MileageCalculator\Services\\*