Get-ChildItem recurse as a parameter in PowerShell -


I am looking to create a function that can toggle the ability to do research inside.

Very basic example:

  ... param ([string] $ source directory = ".", [String] $ fileTypeFilter = "* .log", [Boolean] Get $ recurse = $ true) -ChildItem $ sourceDirectory -recurse -filter $ fileTypeFilter | ...  

How does the -recurse add-child add conditional to Get-ChildItem to not support anything?

I thought that probably could replace a -recurse with a $ recursetext parameter in the Get-ChildItem statement ($ recurse were true If set to "Rakhi") but it does not seem so.

Here are some things. First of all, you do not want to use [boolean] for the type of resource parameter, it is necessary that you pass an argument to the refined parameter on your script, eg -Rector $ is true You want that a [switch] parameter is shown below. Also, when you forward the switch parameter to the child-on-the-recharging parameter, use : as shown below:

  param ([ String] $ sourceDirectory = ".", [String] $ fileTypeFilter = "* .log", [switch] $ recurse) get-childitem $ sourceDirectory-recurse: $ recurse -filter $ fileTypeFilter | ...  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -