Grouping statements and commands into a single block of code in the Windows PowerShell
The following are a few script block samples:
This example loops through each file with the *.txt extension then writes its full name and length to the host.
This example nests an if statement inside a foreach loop.
ASSIGNING SCRIPT BLOCKS TO VARIABLES
You can also assign script blocks to variables as follows:
Use the & to execute the script block variables as follows:
FUNCTIONS AND FILTERS
For information about flow control statements, enter the following command at the PowerShell command prompt:
For information about functions and filters, enter the following command:
For information about scope, enter the following command: