about_function incorrect - by PowerShellDon

Status : 

 


1
0
Sign in
to vote
ID 770663 Comments
Status Active Workarounds
Type Bug Repros 0
Opened 11/9/2012 4:11:44 PM
Access Restriction Public

Description

From the doc about_functions:


      The following example is a function called Get-SmallFiles. This function 
      has a $size parameter. The function displays all the files that are 
      smaller than the value of the $size parameter, and it excludes 
      directories:

          function Get-SmallFiles {
              param ($size)
              Get-ChildItem c:\ | where {$_.Length -lt $Size -and !$_.PSIsContainer} 
          }


      In the function, you can use the $size variable, which is the name 
      defined for the parameter.

      To use this function, type the following command:
 
          C:\PS> function Get-SmallFiles –Size 50


      You can also enter a value for a named parameter without the parameter 
      name. For example, the following command gives the same result as a 
      command that names the Size parameter:

          C:\PS> function Get-SmallFiles 50

Technically, you wouldn't use the keyword "function" when RUNNING the thing, right?
Sign in to post a comment.
Posted by Aleksandar Nikolić on 11/18/2012 at 3:53 PM
And the name should be Get-SmallFile. Singular.