我需要将文件列表复制到不同目标文件夹的列表中。我正在使用的当前脚本适用于一个目标。如何让它在多个目的地工作?
# source and destionation directory
$src_dir = "C:\test\"
$dst_dir = "\\remote_PC\c$\test"
# list of files from source directory that I want to copy to destination folder
# unconditionally
$file_list = "*.txt",
"*.jpg",
"*.doc"
# Copy each file unconditionally (regardless of whether or not the file is there
foreach ($file in $file_list)
{
Copy-Item $src_dir$file $dst_dir
}