I'm running the following command:
get-childitem C:\temp\ -exclude *.svn-base,".svn" -recurse | foreach ($_) {remove-item $_.fullname}
Which prompts me very frequently like this:
Confirm
The item at C:\temp\f\a\d has children and the Recurse parameter was not specified. If you continue,
all children will be removed with the item. Are you sure you want to continue?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
How can I have it automatically set to "A"?
Add -recurse after the remove-item, also the -force parameter helps remove hidden files e.g.:
gci C:\temp\ -exclude *.svn-base,".svn" -recurse | %{ri $_ -force -recurse}
Add -confirm:$false to suppress confirmation.
The default is: no prompt.
You can enable it with
-confirm
or disable it with-confirm:$false
However, it will still prompt, when the target:
-recurse
parameter is not specified.To sum it up:
...should cover all scenarios.
You just need to add a
/A
behind the line.Example:
Try using the
-Force
parameter onRemove-Item
.