【发布时间】:2018-11-10 06:11:16
【问题描述】:
我调查了这个论坛。但似乎不太了解它以找到我的答案。我是 Powershell 的新手。
我有一种情况,我已经启动了一个 ps1 脚本,需要执行另一个 ps1 脚本以在后台启动,并将参数从第一个脚本传递到第二个脚本。
类似这样的东西(script1.ps1):
$var1 = "p1 (string value)"
$var2 = "p2 (string value)"
$var3 = "p3 (string value)"
$var4 = 4 # numeric value
$counter = 1
while ($counter -le $var4)
{
#call to script2.ps1 with passing the $var1 through $var4 as
#parameters so that script2.ps1 executes as a background process
#and works with the received parameters $var1 through $var4
# ??
$counter= $counter + 1
}
exit
########################################
我找不到 1 种方式来传递参数并在后台启动 script2.ps1。
真的希望有人可以帮助我。
THIA, 维姆
【问题讨论】:
-
为什么不想将它们作为数组传递并在脚本中一一处理?
标签: powershell-3.0