Quick PowerShell Script!!

If you have a temp directory that has many items in, selecting all from Explorer and then deleting them takes longer than using a simple PowerShell command:

Here is the command you can run:

  • Get-ChildItem -Path “C:\Windows\Temp” *.* -Recurse | Remove-Item -Force -Recurse

If there are files in use, you will get an error as below which is normal but the bulk of the items should be removed:

That is how simple it is to clear out the temp directory.

Hope it helps.

Advertisements