Anyone knows how to delete all temp files using powershell.
Get-ChildItem $env:TEMP\TEMP | Remove-Item -confirm:$false -force -Recurse
I tired this code but it couldn't work. Can you suggest me any better way to perform the same.
If you don't want to see any errors, you could use the -ErrorAction switch like this:
Remove-Item -Path $env:TEMP -Recurse -Force -ErrorAction SilentlyContinue