I was trying to copy few files into my remote box, but i see the path format is not correct issue, can someone chekc this?
for($hostname in Get-Content C:\folder1\machine.txt){
Copy-Item -Path "C:\folder1\ramen-0.1-web-1.3.6.jar" -Destination "\\hostname\C:\folder1\folder2\" -Recurse -Force
}
Error Message is: Copy-Item : The given path's format is not supported.
CodePudding user response:
Your missing '$' sign. Your are using 'c:' as part of your destination path.
for($hostname in Get-Content C:\folder1\machine.txt){
Copy-Item -Path "C:\folder1\ramen-0.1-web-1.3.6.jar" -Destination "\\hostname\C$\folder1\folder2\" -Recurse -Force
}