Powershell - is there a difference between `&. \ Monkeys.ps1` and` & powershell. \ Monkeys.ps1`?

In Powershell, is there a difference between & .\monkeys.ps1and & powershell .\monkeys.ps1?

+3
source share
2 answers

'&. \ monkeys.ps1' executes the script in the current console (session). '& Amp; powershell. \ Monkeys.ps1' opens a new PowerShell process and runs the script.

+4
source

In addition, if you check the helper help file with powershell, you will see all the custom options available with the powershell executable

powershell /?

This allows you to use advanced functions, such as specifying window parameters, running commands directly from batch files, or running scripts (for example, above)

0
source

All Articles