我需要一些帮助,或者就我正在尝试做的事情提出更好的建议。
我试图复制一些东西,所以我有
$tests = @("test1", "test3", "test5")
$copy_1 = {
$source = "C:\Source\test1"
$Destination = "C:\Destination\test1"
Copy-Item $Source -Recurse -Destination $Destination -Container -Force
}
$copy_2 = {
$source = "C:\Source\test2"
$Destination = "C:\Destination\test2"
Copy-Item $Source -Recurse -Destination $Destination -Container -Force
}
$copy_3 = {
$source = "C:\Source\test3"
$Destination = "C:\Destination\test3"
Copy-Item $Source -Recurse -Destination $Destination -Container -Force
}
$copy_4 = {
$source = "C:\Source\test4"
$Destination = "C:\Destination\test4"
Copy-Item $Source -Recurse -Destination $Destination -Container -Force
}
Foreach($i in $Tests)
{
IF($i -eq "test1)
{
Start-Job -Name $i -Scriptblock {$($i)}
}
}
....
这不会调用我的脚本块。
PSJobTypeName State HasMoreData Location Command
BackgroundJob Running True localhost ($($i))
如何调用 $test1 块?
提前致谢。