Jump to content



Photo

Is it possible to name comment blocks in PowerShell?


  • Please log in to reply
2 replies to this topic

#1 elenarie

elenarie

    Newbie .NET / game dev

  • Tech Issues Solved: 2
  • Joined: 23-March 14
  • OS: Windows 8.1 Pro x64
  • Phone: Lumia 920 Yellow

Posted 16 May 2014 - 03:14

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



#2 Andre S.

Andre S.

    Asik

  • Tech Issues Solved: 11
  • Joined: 26-October 05

Posted 16 May 2014 - 17:12

See

http://stackoverflow.../7344038/154766
http://technet.micro...y/dd819489.aspx



#3 OP elenarie

elenarie

    Newbie .NET / game dev

  • Tech Issues Solved: 2
  • Joined: 23-March 14
  • OS: Windows 8.1 Pro x64
  • Phone: Lumia 920 Yellow

Posted 17 May 2014 - 03:59

 

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.