前言:
目前你们对“cmd删除缓存命令”都比较珍视,朋友们都想要分析一些“cmd删除缓存命令”的相关资讯。那么小编同时在网上汇集了一些关于“cmd删除缓存命令””的相关知识,希望咱们能喜欢,看官们一起来了解一下吧!经常使用浏览器打开OA网站处理工作,时间长了,总是会有大量缓存文件临时文件存在,造成页面打开缓慢,或者干脆没动静,直接打不开。此时需要清理浏览器缓存文件以及TMP下的系统垃圾文件,手动清理,非常繁琐,需要好几个操作步骤。于是为了偷懒,写个批处理进行自动清理,需要清理时,双击自动运行即可。
双击运行BAT文件,选择需要清理的项目,按回车键进行清理。或是选6清理所有,再简单些(也是为了偷懒,少按一个键),直接回车,清理所有缓存和系统临时文件。
BAT文内容如下,新建一个txt文本文件,拷贝下面代码到txt文件中,保存文件。再将该txt文件扩展名修改为.bat(或.cmd)
@echo offrem 关闭屏幕回显rem 以管理员身份运行该批处理文件%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exitrem 设置延迟变量赋值setlocal enabledelayedexpansionrem 清屏clsrem tt变量赋值set tt=批处理清理浏览器缓存文件及系统垃圾文件 xiaoqiangrem 清除所有缓存、临时/垃圾文件变量 Y/Nset clean_all=Nrem 设置背景前景色,并设置显示窗休标题显示文字color 0atitle %tt%rem 设置环境变量set cache_chrome=%userprofile%\AppData\Local\Google\Chrome\User Data\Defaultset cache_360se=%userprofile%\AppData\Roaming\360se6\User Data\Defaultrem 代码段标记,菜单:_mainMenurem 设置窗体高度和宽度mode con cols=90 lines=27clsecho.echo.rem 打印菜单echo 清理浏览器缓存文件及系统垃圾/临时文件,将自动关闭浏览器,请关闭浏览器并保存文件。echo.echo.echo 请选择并输入需要清理的项目:echo.echo 1. 清理 Internet Explorer 浏览器echo. echo 2. 清理 Google Chrome 浏览器echo.echo 3. 清理 360安全浏览器echo.echo 4. 清理 Firefox Browser 浏览器echo.echo 5. 清理系统垃圾文件及临时文件echo. echo 6. 清理以上全部(1-5)选项echo. echo 7. 退出echo.echo. set chooseResult=6rem echo %chooseResult%rem 等待输入set /p chooseResult=请输入需要执行的选项编号:【1/2/3/4/5/6/7, 回车键默认清理所有项】rem 逻辑分支判断 (/i表示勿略大小写)if /i '%chooseResult%'=='' goto _mainMenuif %chooseResult% LSS 1 goto _mainMenuif %chooseResult% GTR 7 goto _mainMenurem 清理 Internet Explorer 浏览器if %chooseResult%==1 (rem 语法:tasklist | find /i "程序" && 程序在运行执行命令1 || 不在运行执行命令2rem 例子:tasklist | find /i "calc.exe" && taskkill /f /im calc.exe || echo 没有运行:_clean_IErem 关闭IE进程tasklist | find /i "iexplore.exe" > nul 2<&1 && taskkill /f /im iexplore.exe > nul 2<&1rem taskkill /f /im IEXPLORE.EXE > nul 2<&1clsecho.echo 正在清除 Internet Explorer 缓存数据echo.echo ____________________________________________________________________________echo.echo 1. 清除历史记录... RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1echo 2. 清除Cookies... RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2echo 3. 清除Internet临时文件... RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8echo 4. 清除表单数据... RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 16echo 5. 清除密码... RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 32echo 6. 清除全部项目... RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255echo ____________________________________________________________________________set time2=%date:~0,4%-%date:~5,2%-%date:~8,2% %time:~0,2%:%time:~3,2%:%time:~6,2%echo.echo.echo !time2! Internet Explorer 缓存数据清除完毕echo.if /i '!clean_all!'=='Y' ( rem echo !clean_all! ping -n 3 127.0.0.1>nul goto _clean_chrome) pause goto _mainMenu)rem 清理 Google Chrome 浏览器if %chooseResult%==2 (:_clean_chromerem 关闭Google Chrome浏览器进程tasklist | find /i "chrome.exe" > nul 2<&1 && taskkill /f /im chrome.exe > nul 2<&1clsecho.echo 正在清除 Google Chrome 缓存数据echo.echo ____________________________________________________________________________echo.echo 1. 清除浏览记录... del /f /s /q "%cache_chrome%\History*" > nul 2<&1 rem del /f /s "%cache_chrome%\History-journal" ping -n 2 127.0.0.1>nul echo 2. 清除 Cookies 及其他网站数据... del /f /s /q "%cache_chrome%\Cookies" > nul 2<&1 del /f /s /q "%cache_chrome%\Cookies-journal" > nul 2<&1 del /f /s /q "%cache_chrome%\Network\Cookies" > nul 2<&1 del /f /s /q "%cache_chrome%\Network\Cookies-journal" > nul 2<&1 ping -n 2 127.0.0.1>nulecho 3. 清除缓存的图片和文件... rd /s /q "%cache_chrome%\Cache\" > nul 2<&1 ping -n 2 127.0.0.1>nulecho 4. 清除登录凭据、表单数据和其他登录数据... del /f /s "%cache_chrome%\Login Data*" > nul 2<&1 del /f /s "%cache_chrome%\Web Data*" > nul 2<&1echo ____________________________________________________________________________set time2=%date:~0,4%-%date:~5,2%-%date:~8,2% %time:~0,2%:%time:~3,2%:%time:~6,2%echo.echo.echo !time2! Google Chrome 缓存数据清除完毕echo.if /i '!clean_all!'=='Y' ( rem echo !clean_all! ping -n 3 127.0.0.1>nul goto _clean_360se)pause goto _mainMenu)rem 清理360SE浏览器if %chooseResult%==3 (:_clean_360serem 关闭360SE浏览器进程tasklist | find /i "360se.exe" > nul 2<&1 && taskkill /f /im 360se.exe > nul 2<&1clsecho.echo 正在清除 360安全浏览器 缓存数据echo.echo ____________________________________________________________________________echo.echo 1. 清除浏览历史(包含历史、网页回收站)... del /f /s /q "%cache_360se%\360History*" > nul 2<&1 del /f /s /q "%cache_360se%\UnClosed Pages*" > nul 2<&1 del /f /s /q "%cache_360se%\Top Sites*" > nul 2<&1 ping -n 2 127.0.0.1>nul echo 2. 清除已保存的网页表单数据... del /f /s /q "%cache_360se%\Login Data*" > nul 2<&1 del /f /s /q "%cache_360se%\Login Data For Account*" > nul 2<&1 del /f /s /q "%cache_360se%\Web Data*" > nul 2<&1 ping -n 2 127.0.0.1>nulecho 3. 清除360浏览器缓存临时文件... rd /s /q "%cache_360se%\Cache\" > nul 2<&1 ping -n 2 127.0.0.1>nulecho 4. 清除Cookies和其他网站数据... del /f /s /q "%cache_360se%\Cookies" > nul 2<&1 del /f /s /q "%cache_360se%\Cookies-journal" > nul 2<&1 del /f /s /q "%cache_360se%\Network\Cookies" > nul 2<&1 del /f /s /q "%cache_360se%\Network\Cookies-journal" > nul 2<&1echo ____________________________________________________________________________set time2=%date:~0,4%-%date:~5,2%-%date:~8,2% %time:~0,2%:%time:~3,2%:%time:~6,2%echo.echo.echo !time2! 360安全浏览器 缓存数据清除完毕echo.if /i '!clean_all!'=='Y' ( rem echo !clean_all! ping -n 3 127.0.0.1>nul goto _clean_firefox)pause goto _mainMenu)rem 清理FireFox浏览器if %chooseResult%==4 (:_clean_firefoxrem 关闭firefox浏览器进程tasklist | find /i "firefox.exe" > nul 2<&1 && taskkill /f /im firefox.exe > nul 2<&1clsecho.echo 正在清除 Firefox 浏览器 缓存数据echo.echo ____________________________________________________________________________echo.echo 1. 清除历史数据(包含全部历史数据、缓存、表单及网站数据等)...rem 在firefox里面输入about:profiles,能看到默认的profiles路径,分为root和local两个set ini_file=%userprofile%\AppData\Roaming\Mozilla\Firefox\profiles.iniset section=Profile0 set key=Pathrem 读取firefox的ini配置文件指定的段中值for /f "tokens=2 delims==" %%a in ('type !ini_file!^| findstr /i /c:"[!section!]" /c:"!key!="') do set profile_path=%%aset profile_path=!profile_path:/=\!rem echo !profile_path! && pauseset cache_firefox=%userprofile%\AppData\Local\Mozilla\Firefox\!profile_path!rem echo !cache_firefox! && pauserem set firefox_roamingProfileDir=%userprofile%\AppData\Roaming\Mozilla\Firefox\Profiles\*.default-esrset profiles_firefox=%userprofile%\AppData\Roaming\Mozilla\Firefox\!profile_path!rem echo !profiles_firefox! && pauserem 删除缓存数据rd /s /q "!cache_firefox!\cache2" > nul 2<&1rd /s /q "!profiles_firefox!\storage" > nul 2<&1ping -n 2 127.0.0.1>nul echo 2. 清除Cookies和其他网站数据...del /f /s /q "!profiles_firefox!\cookies*" > nul 2<&1del /f /s /q "!profiles_firefox!\webappsstore.sqlite" > nul 2<&1 echo ____________________________________________________________________________set time2=%date:~0,4%-%date:~5,2%-%date:~8,2% %time:~0,2%:%time:~3,2%:%time:~6,2%echo.echo.echo !time2! Firefox 浏览器 缓存数据清除完毕echo.if /i '!clean_all!'=='Y' ( rem echo !clean_all! ping -n 3 127.0.0.1>nul goto _clean_tmp)pause goto _mainMenu)rem 清理系统临时文件if %chooseResult%==5 (:_clean_tmprem 关闭360SE浏览器进程tasklist | find /i "360se.exe" > nul 2<&1 && taskkill /f /im 360se.exe > nul 2<&1clsecho.echo 正在清除系统临时及缓存数据echo.echo ____________________________________________________________________________echo.echo.echo 1. 正在清理 %TEMP%... del /f /s /q %TEMP%\. > nul 2<&1 ping -n 2 127.0.0.1>nulecho 2. 正在清理 %SystemRoot%\TEMP... del /f /s /q %SystemRoot%\TEMP\. > nul 2<&1 ping -n 2 127.0.0.1>nulecho ____________________________________________________________________________set time2=%date:~0,4%-%date:~5,2%-%date:~8,2% %time:~0,2%:%time:~3,2%:%time:~6,2%echo.echo.echo !time2! 系统临时及缓存数据清除完毕echo.if /i '!clean_all!'=='Y' ( rem echo !clean_all! ping -n 3 127.0.0.1>nul goto _exit)pause goto _mainMenu)rem 清理所有(1~5项)if %chooseResult%==6 (:_clean_allset clean_all=Ygoto _clean_IErem goto _exit)rem 退出if %chooseResult%==7 (:_exitecho.if /i '!clean_all!'=='Y' ( set /p answerResult=系统清理完毕,您是否要退出清理工具吗?【Y/N】) else (set /p answerResult=您确定要退出清理工具吗?【Y/N】)if /i '!answerResult!'=='Y' ( exit) else if /i '!answerResult!'=='N' ( goto _mainMenu) else ( echo 输入值非法!--请重新输入... goto _exit ))
版权声明:
本站文章均来自互联网搜集,如有侵犯您的权益,请联系我们删除,谢谢。
标签: #cmd删除缓存命令 #internet怎么清除缓存