powershell - 如何在Powershell中将-recurse与Move-item一起使用

标签 powershell

我创建了一个简单的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/

相关文章:

powershell - 我应该避免在Powershell脚本中使用 'dir'别名吗?

powershell - 使用 ps1 脚本向 AD 用户添加组

powershell - 我可以使用 PowerShell 1.0 列出进程及其 PID 和命令行吗?

PowerShell 与 base64 编码有关的问题

regex - PowerShell多字符串替换效率

powershell - 有条件地排除 null 或空的 cmdlet 参数

powershell - 启动进程 : Access is denied (even though i've provided credentials

powershell - Get-WindowsUpdateLog 流重定向

powershell - 从 WinRT 应用调用 PowerShell

json - 重新部署到不同区域时出现 Azure 错误