Board logo

标题: [文件操作] 批处理怎样清理IE缓存? [打印本页]

作者: dawei124578    时间: 2011-2-3 20:14     标题: 批处理怎样清理IE缓存?

公司的电脑很多,IE的版本也有不同,有IE6、IE7、IE8等。每天使用时都要先点击工具-internert选项,手工清理IE缓存【临时文件、Cookies、历史记录等等】。
现我需要一个批处理,要达到如下效果:
1、不管IE6、IE7、IE8哪个版本都能清除;
2、自动检测,当发现电脑开机后,自动运行本批处理;
3、清除完毕后,自动运行桌面某快捷图标,打开一网址;
4、不管目录是C:\Documents and Settings\administrator\Local Settings\Temporary Internet Files
还是C:\Documents and Settings\上\Local Settings\Temp都能清除。

[ 本帖最后由 dawei124578 于 2011-2-3 20:17 编辑 ]
作者: 随风    时间: 2011-2-3 22:13

显示正确后去掉代码中的 echo
  1. @echo off
  2. set "zcb=HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
  3. for %%a in (cache history cookies) do (
  4.    for /f "tokens=1* delims=Z" %%i in ('reg query "%zcb%" /v %%a') do set ".%%a=%%j"
  5. )
  6. for /f "tokens=1* delims== " %%a in ('set .') do (
  7.    if exist "%%b" (
  8.       echo rd /s /q "%%b"
  9.   echo md "%%b"
  10.    )
  11. )
  12. pause
复制代码

作者: dawei124578    时间: 2011-2-4 17:38

你好,随风:?
可能是我不识货,也可能是我学艺不精,我咋没看都代码呢?这是我想要的吗?能加上注解吗?特别是自动运行桌面某快捷图标或者打开一网址【如:www.bathome.net】,这个功能。

[ 本帖最后由 dawei124578 于 2011-2-4 17:58 编辑 ]
作者: hanyeguxing    时间: 2011-2-4 18:16

  1. @echo off
  2. set "z=HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
  3. for %%a in (cache history cookies) do for /f "tokens=2*" %%b in ('reg query "%z%" /v %%a') do if exist "%%c" (
  4. rd /s /q "%%c"
  5. md "%%c"
  6. )
  7. start "" "要打开的文件或网址"
复制代码

作者: dawei124578    时间: 2011-2-4 20:13     标题: 模仿别人的,写了几条,有点差劲,期待指教!!!

@echo off
color 2f
Title 系统垃圾文件清理器
echo.
echo            =========================================================
echo                      *****  系统垃圾文件清理器 专用版  *****
echo.
echo                                   本程序特点
echo.
echo                 1、不管IE6、IE7、IE8哪个版本都能清除;
echo.
echo                 2、自动检测,当发现电脑开机后,自动运行本批处理;
echo.                    
echo                 3、清除完毕后,自动打开网页http://www.bathome.net/index.php
echo.
echo            =========================================================
echo.
echo  开始执行清理……
echo.
set "z=HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
for %%a in (cache history cookies) do for /f "tokens=2*" %%b in ('reg query "%z%" /v %%a') do if exist "%%c" (
        rd /s /q "%%c"
        md "%%c"
)
start "http://www.bathome.net/index.php"

以上语句未能实现开机自动检测运行和自动打开网页这两个功能,望各位赐教期待完美。

[ 本帖最后由 dawei124578 于 2011-2-4 20:16 编辑 ]
作者: gabbyman    时间: 2011-2-4 21:57

学习,学习 谢谢
作者: hanyeguxing    时间: 2011-2-4 22:01     标题: 回复 5楼 的帖子

把该批处理加到启动项里
  1. @echo off&color 2f&Title 系统垃圾文件清理器
  2. more +9 "%~f0"
  3. set "z=HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
  4. for %%a in (cache history cookies) do for /f "tokens=2*" %%b in ('reg query "%z%" /v %%a') do if exist "%%c" (
  5.         rd /s /q "%%c"
  6.         md "%%c"
  7. )
  8. start "" "http://www.bathome.net/index.php"
  9. exit
  10.            =========================================================
  11.                      *****  系统垃圾文件清理器 专用版  *****
  12.                                   本程序特点
  13.                 1、不管IE6、IE7、IE8哪个版本都能清除;
  14.                 2、自动检测,当发现电脑开机后,自动运行本批处理;
  15.                     
  16.                 3、清除完毕后,自动打开网页http://www.bathome.net/index.php;
  17.            =========================================================
复制代码

作者: semiuel    时间: 2011-2-6 16:13

我的电脑不敢清理COOKIES,很多论坛的帐号密码都在这里呢,清理掉就麻烦了.




欢迎光临 批处理之家 (http://bathome.net./) Powered by Discuz! 7.2