上QQ阅读APP看书,第一时间看更新
How it works...
PowerShell usually handles variable scoping automatically. When you're working interactively on the CLI, you'll automatically be using the global scope. Calling a script will execute the script in its own scope, the script scope. Executing a function or a script block in general will launch it into another scope, the local scope.
By explicitly using scope modifiers, you can change variables, aliases, and functions that are usually outside of your current reach. While this allows you to work outside your normal boundaries, you have to be careful not to overwrite the code of your users by using the global scope to a large extent.