这空格真是个问题啊...又做了修改.- @echo off&setlocal enabledelayedexpansion
- for /f "delims=" %%z in ('dir/b/s/a-d rmevents.exe') do set rmevents="%%z"
- title %date%
- :bof
- set result=Error
- set/p "theFile=[拖动文件到此]:"
- if not exist %theFile% goto bof
- cls&&call :eventEdit %theFile%
- echo.
- title %date%
- if {%result%}=={unknown} goto mainEnd
- if {%result%}=={Error} goto mainEnd
- if {%result%}=={Edited} echo ["%theFile%"]&&echo --^>[已经被修改过.]&&goto mainEnd
- if {%result%}=={Existed} echo ["%theFile%"]&&echo --^>[已经被修改过,且目标文件已存在.]&&goto mainEnd
- :delOptLP
- set/p delOpt=[是否要删除源文件(y/n)?]:
- if {%delOpt%}=={y} del/q %theFile%&&echo 删除文件[%theFile%]&&goto mainEnd
- if {%delOpt%}=={n} goto mainEnd
- goto delOptLP
- :mainEnd
- echo.&echo.
- pause
- cls
- goto bof
- :eventEdit
- for /f "delims=" %%c in ("%~1") do set "fName=%%~nc"&&set "fPath=%%~dpc"&&set "fExt=%%~xc"
- if "%fName:~-3,3%"=="_OK" echo -[Skipd]- ["%fName%%fExt%"]&&set result=Edited&&goto eventDone
- if exist "%fPath%%fName%_OK%fExt%" echo -[Skipd]- ["%fName%%fExt%"]&&set result=Existed&&goto eventDone
- if {%fExt%}=={.rmvb} goto startEdit
- if {%fExt%}=={.rm} goto startEdit
- echo [UNKNOWED FILE EXTENSION.]
- set result=unknown
- goto eventDone
- :startEdit
- title ["%fName%%fExt%"]-^>["%fName%_OK%fExt%"],plz wait.
- cd.>events.txt
- %rmevents% -i "%~1" -e events.txt -o "%fPath%%fName%_OK%fExt%"
- del/q events.txt>nul 2>nul
- call :check "%~1" "%fPath%%fName%_OK%fExt%"
- echo -[%result%]- ["%fName%%fExt%"]
- :eventDone
- exit/b
- :check
- set sizeDiff=0
- for /f "delims=" %%d in ("%~1") do set oldSize=%%~zd
- for /f "delims=" %%e in ("%~2") do set newSize=%%~ze
- if %oldSize% geq %newSize% (
- set /a sizeDiff=%oldSize%-%newSize%
- ) else (
- set /a sizeDiff=%newSize%-%oldSize%
- )
- if %sizeDiff% geq 2000000 (
- del/q "%~2"&&set result=Error
- )else (
- set result=Done
- )
- exit/b
复制代码
[ 本帖最后由 TX_kakashi 于 2010-8-26 14:07 编辑 ] |