0
假設我有2個PowerShell腳本,test1.ps1和test2.ps1如何參考。來自另一個powershell腳本的值?
#test1.ps1
$ A = 「測試1」
############ ######
#test2.ps1
回聲$一個
如何REF。 $ test1.ps1中的test1.ps1?
假設我有2個PowerShell腳本,test1.ps1和test2.ps1如何參考。來自另一個powershell腳本的值?
#test1.ps1
$ A = 「測試1」
############ ######
#test2.ps1
回聲$一個
如何REF。 $ test1.ps1中的test1.ps1?
在腳本1:
Set-Variable -Name a -Value "test1" -Scope Global
感謝,全球範圍內的工作。但我希望範圍可以限制在腳本內。這意味着,腳本退出後,變量將被銷燬。我嘗試了Script範圍,但它不起作用。 – davidshen84 2010-06-28 06:30:01
完成後,您可以將其刪除:清除變量a – xcud 2010-06-28 12:19:32