Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Hide Common Code in PowerShell ISE

$
0
0

Summary: Learn how to hide common code in the Windows PowerShell ISE.

Hey, Scripting Guy! Question How can I hide related code in the Windows PowerShell ISE to make it easier to troubleshoot and to read?

Hey, Scripting Guy! Answer Open the ISE, and in the script pane, begin a section with the #Region tag and a name.
           Then end the section with the #EndRegion tag. Now everything between the two tags can be collapsed
           and hidden when desired. Here is an example:

#region Name

 If($d.name -match  ',')

        {

          $name = (Get-Culture).textinfo.ToTitleCase($d.name).Split(',').trim()

          $ln = $name[0]

          $fn = $name[1]

          }

#endregion


Viewing all articles
Browse latest Browse all 3333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>