如何使用bat清理开机启动项

发布时间:2021-09-30 11:45:56 作者:小新
来源:亿速云 阅读:258

这篇文章将为大家详细讲解有关如何使用bat清理开机启动项,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

代码如下:

@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

关于“如何使用bat清理开机启动项”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。

推荐阅读:
  1. 使用python如何清理磁盘日志
  2. 怎么使用bat启动springboot项目

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

bat

上一篇:shell备份文件、重命名文件、删除指定文件的脚本编写教程

下一篇:JavaScript Lazy evaluation中可迭代对象与迭代器是怎样的

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》