如何参考。来自另一个PowerShell脚本的值?

时间:2010-06-28 03:05:08

标签: scripting powershell-v2.0

假设我有2个powershell脚本,test1.ps1和test2.ps1

#test1.ps1

$一个= “测试1”

##################

#test2.ps1

回显$ a

如何参考。来自test1.ps1的test2.ps1中的$ a?

1 个答案:

答案 0 :(得分:0)

在脚本1中:

Set-Variable -Name a -Value "test1" -Scope Global