繁体   English   中英

通过传递参数从另一个PowerShell脚本调用一个PowerShell脚本

[英]Invoke one PowerShell script from Another PowerShell script with passing arguments

我想从test2.ps1调用test1.ps1。 我想在调用时将参数从test2.ps1传递给test1.ps1。

PS C:\> gc .\test2.ps1
.\test1.ps1 'foo'
Write-Host 'bar'
PS C:\> gc .\test1.ps1
$a = $ARGS[0] -split ''
[array]::Reverse($a)
Write-Host ($a -join '')
PS C:\> .\test2.ps1
oof
bar

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM