Suppress automatic confirmation of deletion in powershell
问题 I am trying to write a silent script that deletes files older than 14 days and removes empty folders. The part that deletes files work fine, but the part that deletes folders is popping up a confirmation window no matter what I do to suppress it. Here's my code: $date=(get-date).AddDays(-14) $ConfirmPreference="None" $DebugPreference="SilentlyContinue" $ErrorActionPreference="SilentlyContinue" $ProgressPreference="SilentlyContinue" $VerbosePreference="SilentlyContinue" $WarningPreference=