• 0

Is it possible to name comment blocks in PowerShell?


Question

Hey,

 

This may be a silly question, but I have not used PowerShell that much, so I honestly don't know. I've been trying to find a way to name the comment blocks, but it is really escaping me right now. Is it even possible to name the comment blocks?

 

In C# one can do it like:

/// <NameOfBlock>
/// Comment block...
/// </NameOfBlock>

Right now for PS I am using regions, like the example below, but I'd like to replace them with properly named comment blocks, if possible.

#region Mount
# Mount the VHD.
# The Mount-VHD cmdlet mounts one or more virtual hard disks.

# -NoDriveLetter
# Specifies that the virtual hard disk is to be mounted without assigning drive letters to the volumes contained within the virtual hard disk.

# -ReadOnly
# Specifies that the virtual hard disk is to be mounted in read-only mode.
#endregion
Mount-VHD -Path $Path
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

 

I was looking through that before asking the question, but I may have missed what I wanted. Will go through the links again, thanks.

 

What I am actually referring to is, when you for example create a region, and then press the small - button to hide (is that the correct term?) the region, the first line in the region is shown, allowing you to easily name the region. Example, this is what I get when I collapse? the region.

#region Optimise...

When using comment blocks, I get <# ... #> and I haven't been able to find a way and replace the ... with something meaningful that will clearly show what that comment block is about. But I'll go through the links again. Thanks.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.