& powershell .\other.ps1
and 之间的行为& .\other.ps1
有何不同?
编辑:特别是,如果出现错误,它们有何不同other.ps1
?
Joe*_*oey 12
在前一种情况下,您将获得另一个PowerShell进程,并且该脚本无法读取当前会话中定义的变量:
PS> $foo = 'bar'
PS> 'Write-Host $foo'|Set-Content x.ps1
PS> & powershell .\x.ps1
PS> & .\x.ps1
bar
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
561 次 |
最近记录: |