How does the behaviour differ between & powershell .\other.ps1
and & .\other.ps1
?
Edit: In particular, how do they differ if there's an error in other.ps1
?
You get another PowerShell process in the former case and the script cannot read variables defined in your current session:
PS> $foo = 'bar'
PS> 'Write-Host $foo'|Set-Content x.ps1
PS> & powershell .\x.ps1
PS> & .\x.ps1
bar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With