::update_ini.bat - 批量比对文件内容
::genteman - 2010-07-02 - CMD@WinXP Pro
::contact amdaround@163.com
@echo off
setlocal enabledelayedexpansion
echo 请输入已安装程序和更新软件包的完整路径,并尽量使输入的目录结构一致,以提高比较结果的准确性。
echo 请输入更新软件包路径
:input_patch_path
set /p patch_path=patch_path=
call :verify "%patch_path%"
if defined invalid goto input_patch_path
set invalid=
echo 请输入已安装程序路径
:input_source_path
set /p src_path=src_path=
call :verify "%src_path%"
if defined invalid goto input_source_path
set invalid=
call :init "%src_path%"
call :compare "%patch_path%"
pause & goto :EOF
:verify
if not exist "%~1" echo 路径无效,请重新输入 && set invalid=1
goto :EOF
:init
set n=0
for /R "%~1" %%i in (*.ini) do (
set filename=%%~ni
set char=!filename:~0,1!
set index[!char!][!n!]=%%~nxi
set srcpath[!char!][!n!]=%%~dpi
set /a n+=1
goto :EOF
:compare
for /R "%~1" %%i in (*.ini) do (
set filename=%%~ni
set char=!filename:~0,1!
set flag=0
set same=0
for /f "tokens=1,2 delims==" %%a in ('set index[!char!]') do (
if /i %%b==%%~nxi (
set flag=1
set n=%%a
set n=!n:~9,-1!
rem set index[%char%] | findstr /i /c:"%%~nxi" >nul
if !flag!==1 (
set srcpathh=srcpath[!char!][!n!]
set indexx=index[!char!][!n!]
for /f "tokens=1,2 delims==" %%l in ('set !srcpathh!') do (
set srcpath=%%m
set srcname=!srcpath!!%%~nxi
fc /lb400 /c /l /w "%%i" "!srcname!" | findstr /c:"找不到" >nul && set same=1
if !same!==0 echo !srcname!需要更新。
) else (
echo %%~nxi文件不存在,请从补丁包中复制。
1:
update_ini(ver2).zip
(2010-7-2 20:19, 933 bytes,下载次数: 3)
论坛跳转: