Home Dashboard Directory Help
Search

about_function incorrect by PowerShellDon


Status: 

Active


1
0
Sign in
to vote
Type: Bug
ID: 770663
Opened: 11/9/2012 4:11:44 PM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

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?
Details
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.
Sign in to post a workaround.