Abstract
The PowerShell programming language is very dynamic. Until now, I have focused on its abilities to manipulate objects of any kind. In this chapter, we will explore my favorite language feature: script blocks. Blocks help craft elegant code not only when manipulating collections of objects but in many other situations. Most importantly, script blocks allow us to encapsulate pieces of code and delay their execution. Script blocks are containers holding pieces of code that do not have to be assigned a formal name. We can create them dynamically in the middle of any script operation, and, of course, we can execute them multiple times, passing different parameters.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Rights and permissions
Copyright information
© 2008 Hristo Deshev
About this chapter
Cite this chapter
(2008). Working with Script Blocks. In: Pro Windows PowerShell. Apress. https://doi.org/10.1007/978-1-4302-0546-3_4
Download citation
DOI: https://doi.org/10.1007/978-1-4302-0546-3_4
Publisher Name: Apress
Print ISBN: 978-1-59059-940-2
Online ISBN: 978-1-4302-0546-3
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)