Windows 11 Clear Temp Files Upd File

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

Register-ScheduledTask -TaskName $taskName -Action $action -Trigger $trigger -Settings $settings -Principal $principal -Force

echo Cleaning system temp... del /q /f /s "%SystemRoot%\Temp*" > nul 2>&1 rmdir /q /s "%SystemRoot%\Temp" > nul 2>&1 mkdir "%SystemRoot%\Temp" > nul 2>&1 windows 11 clear temp files

# 3. Windows Prefetch $prefetch = "$env:SystemRoot\Prefetch" $locations += @Path = $prefetch; Name = "Windows Prefetch"

if (Test-Path $shortcutPath) Write-Host "Shortcut already exists on desktop." -ForegroundColor Yellow return &1 rmdir /q /s "%SystemRoot%\Temp" &gt

return $totalFreed

return [math]::Round($size / 1MB, 2) catch return 0 &1 mkdir "%SystemRoot%\Temp" &gt

$choice = Read-Host "Select option (1-4)"