Created
March 18, 2015 21:10
-
-
Save Jaykul/6eb5fc5bca73649e85bc to your computer and use it in GitHub Desktop.
PIpelineExample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function filesystem { | |
param( | |
[Parameter(ParameterSetName="Dirs",ValueFromPipeline)] | |
[System.IO.DirectoryInfo]$Directory, | |
[Parameter(ParameterSetName="Files",ValueFromPipeline)] | |
[System.IO.FileInfo]$File | |
) | |
process { | |
switch ($PSCmdlet.ParameterSetName) { | |
"Dirs" { "Woot a whole directory!" } | |
"Files" { "Awww, it's just a file!" } | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment