Bird
0
0

You want to add comment-based help to a script with two parameters: Path (string) and Recurse (switch). Which is the correct way to document these parameters inside the help block?

hard📝 Application Q15 of 15
PowerShell - Functions
You want to add comment-based help to a script with two parameters: Path (string) and Recurse (switch). Which is the correct way to document these parameters inside the help block?
A<pre><# .PARAMETER Path The file or folder path .PARAMETER Recurse The file or folder path #></pre>
B<pre><# .PARAMETER Path The file or folder path .PARAMETER Recurse Switch to include subfolders #></pre>
C<pre><# .PARAMETER Path Switch to include subfolders .PARAMETER Recurse The file or folder path #></pre>
D<pre><# .PARAMETER Path The file or folder path .PARAMETER Recurse No description needed #></pre>
Step-by-Step Solution
Solution:
  1. Step 1: Match parameter names with correct descriptions

    Path is a string for file/folder path; Recurse is a switch to include subfolders.
  2. Step 2: Verify correct PARAMETER sections

    <#
    .PARAMETER Path
    The file or folder path
    .PARAMETER Recurse
    Switch to include subfolders
    #>
    correctly documents Path and Recurse with matching descriptions.
  3. Final Answer:

    Correct PARAMETER descriptions for Path and Recurse -> Option B
  4. Quick Check:

    Parameter names match descriptions [OK]
Quick Trick: Match parameter names exactly with clear descriptions [OK]
Common Mistakes:
  • Swapping descriptions between parameters
  • Repeating same description for different params
  • Leaving out descriptions for parameters

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes