簡體   English   中英

使用Powershell將單個文件復制到具有相同名稱的多個文件夾

[英]Copy a single file to multiple folders with same name using powershell

我想使用Powershell將一個文件復制到具有相同名稱的多個文件夾中。 例如:我想將C:\\ test.html復制到D:\\ App,但僅復制到D:\\ App內名為“ Config”的文件夾。

如何使用Powershell做到這一點?

Get-ChildItem -path D:\App -Directory -filter Config -recurse|
  ForEach{Copy-Item C:\test.html -Destination $_.FullName -whatif}

如果輸出正常,請刪除-whatif

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM