簡體   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