anic17 / Batch-Antivirus

Batch Antivirus, a powerful antivirus suite written in batch with real-time protection and heuristical scanning.
http://anic17.github.io/Batch-Antivirus
GNU General Public License v3.0
47 stars 4 forks source link

BAVCleaner (Suggestion + Code) #20

Open Jo8ujethoia opened 3 days ago

Jo8ujethoia commented 3 days ago

Hey, i have been using BAV for a while now, and for it to be a really good Windows defender-enhancement i made a cleaner for it, to add more features. If you think its unfitting you dont have to include it but i think it would be fun. Here is the code: @echo off title BAVCleaner - Advanced Windows Device Cleaner color 0A set LOGFILE=%TEMP%\BAVCleaner.log set ERRORLOG=%TEMP%\BAVCleaner_error.log

:log echo [%date% %time%] %1 >> %LOGFILE%

:errorlog echo [%date% %time%] ERROR: %1 >> %ERRORLOG%

:main_menu cls echo =============================== echo BAVCleaner - Main Menu echo =============================== echo. echo 1. Clean Temp Files echo 2. Clean Prefetch Files echo 3. Clean Recycle Bin echo 4. Clear DNS Cache echo 5. Clean Windows Update Cache echo 6. Delete Windows Error Logs echo 7. Disk Cleanup echo 8. Check Disk for Errors echo 9. Defragment Drive echo 10. Remove Old Windows Installations echo 11. Remove Browser Cache (Edge, Chrome, Firefox) echo 12. Disable Hibernation echo 13. Manage Startup Programs echo 14. Disable Unnecessary Services echo 15. Optimize Paging File Settings echo 16. Flush ARP Cache echo 17. Clean System Restore Points echo 18. Full System Report echo. set /p choice="Choose an option (1-18): "

if "%choice%"=="1" goto clean_temp if "%choice%"=="2" goto clean_prefetch if "%choice%"=="3" goto clean_recycle_bin if "%choice%"=="4" goto clear_dns if "%choice%"=="5" goto clean_windows_update_cache if "%choice%"=="6" goto delete_error_logs if "%choice%"=="7" goto disk_cleanup if "%choice%"=="8" goto check_disk if "%choice%"=="9" goto defrag_disk if "%choice%"=="10" goto remove_old_windows if "%choice%"=="11" goto clean_browser_cache if "%choice%"=="12" goto disable_hibernation if "%choice%"=="13" goto manage_startup if "%choice%"=="14" goto disable_services if "%choice%"=="15" goto optimize_paging if "%choice%"=="16" goto flush_arp_cache if "%choice%"=="17" goto clean_restore_points if "%choice%"=="18" goto system_report goto main_menu

:clean_temp echo Cleaning Temporary Files... del /q /f /s %TEMP%*.* >nul 2>&1 rd /s /q %TEMP% >nul 2>&1 md %TEMP% call :log "Cleaned temporary files." goto main_menu

:clean_prefetch echo Cleaning Prefetch Files... del /q /f /s C:\Windows\Prefetch*.* >nul 2>&1 call :log "Cleaned prefetch files." goto main_menu

:clean_recycle_bin echo Emptying Recycle Bin... rd /s /q C:\$Recycle.Bin >nul 2>&1 call :log "Emptied Recycle Bin." goto main_menu

:clear_dns echo Flushing DNS Cache... ipconfig /flushdns >nul call :log "Cleared DNS cache." goto main_menu

:clean_windows_update_cache echo Cleaning Windows Update Cache... net stop wuauserv >nul 2>&1 del /q /f /s C:\Windows\SoftwareDistribution*.* >nul 2>&1 net start wuauserv >nul 2>&1 call :log "Cleaned Windows Update cache." goto main_menu

:delete_error_logs echo Deleting Windows Error Logs... del /q /f /s C:\Windows\System32\LogFiles*. >nul 2>&1 del /q /f /s C:\Windows\Logs*. >nul 2>&1 call :log "Deleted Windows error logs." goto main_menu

:disk_cleanup echo Running Disk Cleanup... cleanmgr /sagerun:1 >nul call :log "Ran Disk Cleanup." goto main_menu

:check_disk echo Checking Disk for Errors... chkdsk /f /r C: call :log "Checked disk for errors." goto main_menu

:defrag_disk echo Defragmenting Disk... defrag C: /O >nul call :log "Defragmented disk." goto main_menu

:remove_old_windows echo Removing Old Windows Installations... rd /s /q C:\Windows.old >nul 2>&1 call :log "Removed old Windows installations." goto main_menu

:clean_browser_cache echo Cleaning Browser Cache... :: Clean Edge del /q /f /s "%localappdata%\Microsoft\Edge\User Data\Default\Cache*." >nul 2>&1 :: Clean Chrome del /q /f /s "%localappdata%\Google\Chrome\User Data\Default\Cache*." >nul 2>&1 :: Clean Firefox del /q /f /s "%appdata%\Mozilla\Firefox\Profiles*\cache2\entries*.*" >nul 2>&1 call :log "Cleaned browser cache." goto main_menu

:disable_hibernation echo Disabling Hibernation... powercfg -h off >nul call :log "Disabled hibernation." goto main_menu

:manage_startup echo Managing Startup Programs... start msconfig call :log "Opened Startup Programs manager." goto main_menu

:disable_services echo Disabling Unnecessary Services... sc config "DiagTrack" start= disabled >nul sc config "SysMain" start= disabled >nul sc stop "DiagTrack" >nul sc stop "SysMain" >nul call :log "Disabled unnecessary services." goto main_menu

:optimize_paging echo Optimizing Paging File Settings... wmic computersystem where name="%computername%" set AutomaticManagedPagefile=True >nul call :log "Optimized paging file settings." goto main_menu

:flush_arp_cache echo Flushing ARP Cache... arp -d >nul call :log "Flushed ARP cache." goto main_menu

:clean_restore_points echo Cleaning System Restore Points... vssadmin delete shadows /all /quiet >nul call :log "Cleaned system restore points." goto main_menu

:system_report echo Generating Full System Report... systeminfo > %TEMP%\SystemReport.txt start notepad %TEMP%\SystemReport.txt call :log "Generated full system report." goto main_menu

anic17 commented 3 days ago

That could be a submodule for system maintenance, I'll see if I'll add it on v4.0.0 with a few modifications to seamlessly integrate it into Batch Antivirus

Jo8ujethoia commented 3 days ago

Alright thanks