使用 powershell 将文件夹中的文件替换为其他文件夹中的文件
Replace files in a folder with files in other folder, using powershell
我有两个文件夹。
Folder1 包含许多文件。
Folder2 是 folder1 中一组文件的服务包。
我想通过 PowerShell 将 Folder1 中的特定文件替换为 Folder2 中的文件。
-Replace
是正确的起点吗?我该如何处理?
更新
Get-ChildItem $hotfix | ForEach-Object {Copy-Item $_.FullName -Destination $original -force}
抱歉,我迟交了答案。但它在这里 !!
所以,
1. Folder1 命名为 $original
2. Folder2 被命名为 $hotfix
Get-ChildItem $hotfix | ForEach-Object {Copy-Item $_.FullName -Destination $original -force}
这会将$original 和$hotfix 中的所有公共文件替换为$hotfix 中的文件!
我有两个文件夹。
Folder1 包含许多文件。
Folder2 是 folder1 中一组文件的服务包。
我想通过 PowerShell 将 Folder1 中的特定文件替换为 Folder2 中的文件。
-Replace
是正确的起点吗?我该如何处理?
更新
Get-ChildItem $hotfix | ForEach-Object {Copy-Item $_.FullName -Destination $original -force}
抱歉,我迟交了答案。但它在这里 !!
所以, 1. Folder1 命名为 $original 2. Folder2 被命名为 $hotfix
Get-ChildItem $hotfix | ForEach-Object {Copy-Item $_.FullName -Destination $original -force}
这会将$original 和$hotfix 中的所有公共文件替换为$hotfix 中的文件!