我创建了一个简单的powershell脚本,其中将文件从源文件夹复制到具有相同目录结构的目标。
$source_path ="C:\Akash\Working\Source\*"
$backupPath="C:\Akash\Working\Dest"
copy-Item $source_path $backupPath -Recurse -EA "silentlycontinue"
它工作正常,但是当我尝试使用move-item代替copy-item时,会抛出一个错误:
Move-Item : A parameter cannot be found that matches parameter name 'Recurse'.
有人请在这里建议...
最佳答案
Move-Item cmdlet没有-Recurse
开关。
不需要,因为它已经复制了所有子项:
The Move-Item cmdlet moves an item, including its properties, contents, and child items, from one location to another location.
关于powershell - 如何在Powershell中将-recurse与Move-item一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29072545/