Write-Host "" Write-Host "Total space freed: $(Format-FileSize $totalFreed)" -ForegroundColor Green Write-Host "========================================" -ForegroundColor Cyan
return $totalFreed
$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File `"$scriptPath`" -Silent" $trigger = New-ScheduledTaskTrigger -Weekly -DaysOfWeek Sunday -At 3am $settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -StartWhenAvailable $principal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -LogonType ServiceAccount -RunLevel Highest windows 11 clear temp files
switch ($choice) "1" Clear-TempFiles "2" Create-Shortcut "3" Create-ScheduledTask "4" exit default Write-Host "Invalid option" -ForegroundColor Red Name = "Internet Cache"
echo Emptying recycle bin... powershell.exe -Command "Clear-RecycleBin -Force" windows 11 clear temp files
# 8. Temporary Internet Files $internetTemp = "$env:USERPROFILE\AppData\Local\Microsoft\Windows\INetCache" $locations += @Path = $internetTemp; Name = "Internet Cache"