about_Comment_Based_Help.help

About_Comment_Based_ - TOPIC about_Comment_Based_Help SHORT DESCRIPTION Describes how to write comment-based Help topics for functions and scripts

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 TOPIC about_Comment_Based_Help SHORT DESCRIPTION Describes how to write comment-based Help topics for functions and scripts. LONG DESCRIPTION You can write comment-based Help topics for functions and scripts by using special Help comment keywords. The Get-Help cmdlet displays comment-based Help in the same format in which it displays the cmdlet Help topics that are generated from XML files. Users can use all of the parameters of Get-Help, such as Detailed, Full, Example, and Online, to display function and script Help. You can also write XML-based Help files for scripts and functions by using Help comment keywords, and you can redirect users to a different Help file. This topic explains how to write Help topics for functions and scripts. For information about how to display Help topics for functions and scripts, see Get-Help. SYNTAX FOR COMMENT-BASED HELP The syntax for comment-based Help is as follows: # .< help keyword> # <help content> -or - <# .< help keyword> < help content> #> Comment-based Help is written as a series of comments. You can type a comment symbol (#) before each line of comments, or you can use the "<#" and "#>" symbols to create a comment block. All the lines within the comment block are interpreted as comments. All of the lines in a comment-based Help topic must be contiguous. If a comment-based Help topic follows a comment that is not part of the Help topic, there must be at least one blank line between the last non-Help comment line and the beginning of the comment-based Help. Keywords define each section of comment-based Help. Each comment-based Help keyword is preceded by a dot (.). The keywords can appear in any order. The keyword names are not case-sensitive. For example, the Description keyword precedes a description of a function or
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Sheet1 Page 2 script. <# .Description Get-Function displays the name and syntax of all functions in the session. #> The comment block must contain at least one keyword. Some of the keywords, such as EXAMPLE, can appear many times in the same comment block. The Help content for each keyword begins on the line after the keyword and can span multiple lines. SYNTAX FOR COMMENT-BASED HELP IN FUNCTIONS Comment-based Help for a function can appear in one of three locations: -- At the beginning of the function body. -- At the end of the function body. -- Before the Function keyword. There cannot be more than one blank line between the last line of the function Help and the Function keyword. For example: function MyFunction { <# .< help keyword> < help content> #> <function commands> } -or - function MyFunction { <function commands> <# .< help keyword> < help content> #> }
Background image of page 2
Sheet1 Page 3 -or - <# .< help keyword> < help content> #> function MyFunction { } SYNTAX FOR COMMENT-BASED HELP IN SCRIPTS Comment-based Help for a script can appear in one of the following two locations in the script. -- At the beginning of the script file. Script Help can be preceded in the
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/03/2010 for the course BUS fin taught by Professor Fez during the Spring '10 term at Valparaiso.

Page1 / 12

About_Comment_Based_ - TOPIC about_Comment_Based_Help SHORT DESCRIPTION Describes how to write comment-based Help topics for functions and scripts

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online