Skip to content

Instantly share code, notes, and snippets.

@Jaykul
Created March 18, 2015 21:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jaykul/6eb5fc5bca73649e85bc to your computer and use it in GitHub Desktop.
Save Jaykul/6eb5fc5bca73649e85bc to your computer and use it in GitHub Desktop.
PIpelineExample
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