开机启动项清理代码bat版

所属分类: 脚本专栏 / DOS/BAT 阅读数: 497
收藏 0 赞 0 分享
复制代码 代码如下:

@echo off&setlocal enabledelayedexpansion
mode con cols=61 lines=25&color f5
mshta vbscript:msgbox("在运行程序前,请确认所有编辑资料已经保存",,"自制优化系统")(window.close)
if exist tem.txt del /f /q tem.txt
echo.正在刷选进程.............
echo>>tem.txt explorer.exe
echo>>tem.txt System Idle Process
echo>>tem.txt System
echo>>tem.txt smss.exe
echo>>tem.txt csrss.exe
echo>>tem.txt winlogon.exe
echo>>tem.txt services.exe
echo>>tem.txt TheWorld.exe
echo>>tem.txt lsass.exe
echo>>tem.txt svchost.exe
echo>>tem.txt spoolsv.exe
echo>>tem.txt alg.exe
echo>>tem.txt ctfmon.exe
echo>>tem.txt ekrn.exe
echo>>tem.txt wdfmgr.exe
echo>>tem.txt 360tray.exe
echo>>tem.txt egui.exe
echo>>tem.txt wmiprvse.exe
echo>>tem.txt QQ.exe
echo>>tem.txt cmd.exe
echo>>tem.txt IEXPLORE.EXE
echo>>tem.txt TXPlatform.exe
echo>>tem.txt tasklist.exe
echo>>tem.txt conime.exe
echo>>tem.txt safeboxTray.exe
echo>>tem.txt Thunder5.exe
echo>>tem.txt tudouva.exe
for /f "eol= tokens=1,2 delims=," %%i in ('tasklist /nh /fo csv') do (
findstr /i /x %%i tem.txt >nul
if errorlevel 1 (
taskkill /f /pid %%j 1>nul 2>nul
)
)
del tem.txt & echo 结束进程任务基本完成
echo ======================================
echo ==                                  ==
echo ======================================
echo 优化开机启动项
del /f /s /q "%systemdrive%\Docume~1\All Users\「开始」菜单\程序\启动\*.*"
del /f /s /q "%userprofile%\「开始」菜单\程序\启动\*.*"
for /f "delims=\" %%j in ('fsutil fsinfo drives^|find /v ""') do (
del /f /q "%%j\*.inf">nul 2>nul &del /f /q /ah "%%j\*.exe" 2>nul
)
echo>>tem.txt "egui"
echo>>tem.txt "essact"
echo>>tem.txt "CTFMON.EXE"
set key=Software\Microsoft\Windows\CurrentVersion\run
REG EXPORT "HKCU\%key%" a.reg /nt4>nul
echo REGEDIT4 >b.reg
echo [HKEY_CURRENT_USER\%key%] >>b.reg
for /f "skip=2 eol=[ tokens=1,2 delims==" %%a in (a.reg) do (
findstr /i %%a tem.txt>nul||echo %%a=- >>b.reg
)
for /f "skip=2 delims=[" %%m in ('find /i "\run\" a.reg') do (
echo ^[^-%%m >>b.reg
)
regedit /s b.reg
REG EXPORT "HKLM\%key%" a.reg /nt4>nul
echo REGEDIT4 >b.reg
echo [HKEY_LOCAL_MACHINE\%key%] >>b.reg
for /f "skip=2 eol=[ tokens=1,2 delims==" %%a in (a.reg) do (
findstr /i %%a tem.txt>nul||echo %%a=- >>b.reg
)
for /f "skip=2 delims=[" %%m in ('find /i "\run\" a.reg') do (
echo ^[^-%%m >>b.reg
)
regedit /s b.reg
del /q a.reg
del /q b.reg
del tem.txt
echo 已经优化好
echo ======================================
echo ==                                  ==
echo ======================================
echo 清理部分系统垃圾
del /f /q %systemdrive%\*.tmp>nul 2>nul
del /f /q %systemdrive%\*._mp>nul 2>nul
del /f /q %systemdrive%\*.log>nul 2>nul
del /f /q %systemdrive%\*.gid>nul 2>nul
del /f /q %systemdrive%\*.chk>nul 2>nul
del /f /q %systemdrive%\*.old>nul 2>nul
del /f /q %windir%\*.bak>nul 2>nul
del /f /q %windir%\*.tmp>nul 2>nul
del /f /q %windir%\prefetch\*.*>nul 2>nul
del /f /s /q %systemdrive%\recycled\*.*>nul 2>nul
del /f /q "%ALLUSERSPROFILE%\Documents\DrWatson\*.*">nul 2>nul
del /f /q "%USERPROFILE%\Cookies\*.txt">nul 2>nul
del /f /q /s "%TEMP%\*.*">nul 2>nul
del /f /q /s "%Systemroot%\Prefetch\*.*">nul 2>nul
del /f /q "%USERPROFILE%\Recent\*.*">nul 2>nul
del /f /q "%USERPROFILE%\Application Data\Microsoft\Office\Recent\*.lnk">nul 2>nul
del /f /q /s "%USERPROFILE%\Local Settings\Temp\*.*">nul 2>nul
rd /s /q %windir%\temp & md %windir%\temp>nul 2>nul
if not exist %SystemRoot%\Minidump\NUL del /f /q /s %SystemRoot%\Minidump\*.*>nul 2>nul
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*">nul 2>nul
echo 已经清理了
mshta vbscript:msgbox("everything done!!",,"完成信息")(window.close)
taskkill /f /im cmd.exe
更多精彩内容其他人还在看

批处理命令详解之目录跳转:cd

本文给大家介绍的是我们在处理不同路径下文件的时候需要使用的目录跳转命令CD,非常的详细,希望大家看了本文之后可以熟练的使用这个命令。好了,下面我们就来详细介绍下吧。
收藏 0 赞 0 分享

批处理命令教学之tree命令

本文给大家介绍的是本系列文章的第二个命令--tree命令,在cmd中,tree命令的功能是以树形格式罗列文件,非常的实用的一个命令,下面我们就来详细看下它的用法
收藏 0 赞 0 分享

批处理命令教学之if语句

这篇文章主要介绍了Windows批处理命令中IF的使用方法,推荐给大家,有需要的小伙伴可以参考下。
收藏 0 赞 0 分享

批处理命令教学之管道符号(|)

本文给大家分享的是批处理命令教学系列中的管道符号(|)的使用方法,非常的详细,推荐给小伙伴们,希望大家能够喜欢。
收藏 0 赞 0 分享

批处理命令教学之复合语句连接符(&、&&和||)

这篇文章主要介绍了批处理命令教学之复合语句连接符(&、&&和||)的相关资料,需要的朋友可以参考下
收藏 0 赞 0 分享

批处理命令教学之字符串排序(sort)

这篇文章主要介绍了批处理命令教学之字符串排序:sort的相关资料,需要的朋友可以参考下
收藏 0 赞 0 分享

批处理命令教学之more命令

这篇文章主要介绍了批处理命令中的more命令,十分的详细,包含了more的参数的使用,推荐给小伙伴,有需要的朋友可以参考下。
收藏 0 赞 0 分享

bat/cmd批处理连接SqlServer数据库查询脚本

这篇文章主要介绍了bat/cmd批处理连接SqlServer数据库查询脚本,需要的朋友可以参考下
收藏 0 赞 0 分享

BAT批处理一键生成APK包脚本分享

这篇文章主要介绍了BAT批处理一键生成APK包脚本分享,本文脚本适用于cocos2dx+lua的项目,需要的朋友可以参考下
收藏 0 赞 0 分享

批处理脚本实现提醒下班要打卡

本文给大家分享的是使用批处理脚本实现提醒下班要打卡的方法,一共2个版本,小伙伴们根据自己的情况来选择吧。
收藏 0 赞 0 分享
查看更多