Automatic confirmation of deletion in powershell
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:
- is a directory
- and it is not empty
- and the
-Recurse
parameter is not specified.
-Force
is required to also remove hidden and read-only items etc.
To sum it up:
Remove-Item -Recurse -Force -Confirm:$false
...should cover all scenarios.
Try using the -Force
parameter on Remove-Item
.
Add -confirm:$false to suppress confirmation.