批处理之家's Archiver

Wingl83 发表于 2008-8-2 15:10

批处理提取IE缓存的指定文件

[code]echo off
set file_num=0
cls
echo 请选择要提取的文件类型
echo 1(swf) 2(flv) 3(jpg) 4(gif) 5(mp3) 6(wma) 7(htm) 8(其它类型) 9(清除IE缓存)
set /p type=
if %type%==1 (set filetype=swf)
if %type%==2 (set filetype=flv)
if %type%==3 (set filetype=jpg)
if %type%==4 (set filetype=gif)
if %type%==5 (set filetype=mp3)
if %type%==6 (set filetype=wma)
if %type%==7 (set filetype=htm)
if %type%==8 (echo 请输入文件类型,例如bmp
set /p filetype=)
if %type%==9 (goto :clear_cache)

:select_del_or_not
echo 提取后是否删除原文件?(y/n)
set /p delornot=
if %delornot%==y (goto startcopy)
if %delornot%==n (goto startcopy)
goto select_del_or_not
:startcopy
echo 正在提取文件,请稍候……
md %filetype%
for /f "delims=" %%i in ('dir "%userprofile%\Local Settings\Temporary Internet Files\*.%filetype%" /s/b') do if not exist "%CD%\%filetype%\%%~nxi" (
copy /y "%%i" "%CD%\%filetype%\") else (
call :copy_same_name_file "%%~i" "%%~ni" "%%~xi")
if %delornot%==y (for /f "delims=" %%i in ('dir "%userprofile%\Local Settings\Temporary Internet Files\*.%filetype%" /s/b') do del /f/q "%%i")
goto :eof

:copy_same_name_file
set file_n=%2
set file_x=%3
set /a file_num+=1
::变量file_num自加1
echo %file_num%
if not exist "%CD%\%filetype%\%file_n%_%file_num%%file_x%" (
copy %1 "%CD%\%filetype%\%file_n%_%file_num%%file_x%">nul
) else call :copy_same_name_file %1 %2 %3
set file_num=0
goto :eof
:clear_cache
for /f "delims=" %%i in ('dir "%userprofile%\Local Settings\Temporary Internet Files\*.*" /s/b') do del /f/q "%%i"
goto :eof [/code]
试验了一下,发现若按9——清除IE缓存时并不能做到,我是一个小菜鸟,希望可以帮我修改一下。

Batcher 发表于 2008-8-4 20:52

是倒数第二句的问题吧,这样可以吗?[code]rd /s /q "%userprofile%\Local Settings\Temporary Internet Files\Content.IE5">nul 2>nul[/code]

Wingl83 发表于 2008-8-5 15:02

不清楚嘢,是将什么改成[code]rd /s /q "%userprofile%\Local Settings\Temporary Internet Files\Content.IE5">nul 2>nul[/code]呢?

Batcher 发表于 2008-8-5 23:14

2楼不是说了吗?倒数第二句^_^

Wingl83 发表于 2008-8-6 00:35

[color=SandyBrown]不行嘢,加油……[/color]

Batcher 发表于 2008-8-6 09:25

我行嘢,加油……

Wingl83 发表于 2008-8-6 10:55

[color=hotpink]晕倒中……[/color]

[[i] 本帖最后由 Wingl83 于 2008-8-6 10:57 编辑 [/i]]

52mn998 发表于 2009-3-27 18:39

晕晕哦,还是出错啊,我看了好久还是不知道那里有问题

chinaweike 发表于 2009-10-22 12:40

太强了,能教教我吗?我才学的,行的话加我QQ:125350211,谢谢

lxzzr 发表于 2009-10-22 18:07

还请楼主注明出处....

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.