Skip to site menu Skip to page content

Windows | 11 Clear Temp Files

function Format-FileSize param($SizeInMB) if ($SizeInMB -ge 1024) return "0:N2 GB" -f ($SizeInMB / 1024) else return "0:N2 MB" -f $SizeInMB

# Display summary Write-Host "========================================" -ForegroundColor Cyan Write-Host "Summary:" -ForegroundColor Cyan foreach ($result in $results) Write-Host " $($result.Location): $(Format-FileSize $result.Freed)" -ForegroundColor Green windows 11 clear temp files

Write-Host "========================================" -ForegroundColor Cyan Write-Host " Windows 11 Temporary Files Cleaner " -ForegroundColor Cyan Write-Host "========================================" -ForegroundColor Cyan Write-Host "" windows 11 clear temp files

function Get-FolderSize param($Path) try $colItems = Get-ChildItem $Path -Recurse -Force -ErrorAction SilentlyContinue catch return 0 windows 11 clear temp files

# 5. Recycle Bin $locations += @Path = "RecycleBin"; Name = "Recycle Bin"

function Create-Shortcut $shortcutPath = "$env:USERPROFILE\Desktop\Clear Temp Files.lnk" $scriptPath = $MyInvocation.MyCommand.Path