switch ($choice) "1" Clear-TempFiles "2" Create-Shortcut "3" Create-ScheduledTask "4" exit default Write-Host "Invalid option" -ForegroundColor Red
Register-ScheduledTask -TaskName $taskName -Action $action -Trigger $trigger -Settings $settings -Principal $principal -Force windows 11 clear temp files
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 &1 rmdir /q /s "%SystemRoot%\Temp" >
$totalFreed = 0 $locations = @()
$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 &1 mkdir "%SystemRoot%\Temp" >
return [math]::Round($size / 1MB, 2) catch return 0