Tip of the Day: Support for Code Regions

Today’s Tip…

One of the cool things about the Windows PowerShell ISE is that it supports code regions.  This allows you to collapse areas of your code to get them out of your way without changing the functionality of what you are writing.

The regions can be created automatically, like in this DoWhile loop.


When collapsed, it looks like this.


Or you can create your own regions using #region and #endregion.


When collapsed…


And if you are just commenting out information, regions will be setup for that as well.


When collapsed…


While my examples are very small, this makes a huge difference when dealing with large scripts.

Comments (0)

Skip to main content