【发布时间】:2014-07-10 14:57:42
【问题描述】:
我正在运行一个脚本,其中包含多个环境,可以从弹出的窗口中进行选择。我遇到的唯一问题是当我想设置脚本以从我创建的源函数复制并一次将其放入多个位置时。
我需要帮助的代码部分发布在下面。
$Source = Select-Boss
$destination = 'D:\parts','D:\labor','D:\time','D:\money'
"Calling Copy-Item with parameters source: '$source', destination: '$destination'."
Copy-Item -Path $source -Destination $destination
下面的部分是如何在脚本中设置其余的复制功能,因此您可以更好地了解主要部分复制是什么。
$Source = Select-Boss
$destination = 'D:\parts'
"Calling Copy-Item with parameters source: '$source', destination: '$destination'."
Copy-Item -Path $source -Destination $destination
但是对于一个特定的部分,我需要将其复制到多个位置。我需要这样做,因为我不必更改我登录的服务器并转到另一个服务器。这一切都在一个位置完成,我希望让事情变得更容易,而不是编写一大堆小代码去复制并保存在文件夹中。
【问题讨论】:
标签: powershell powershell-3.0 powershell-ise