bat MD5 calculation and outputs the specified file txt

@echo  OFF 

the SET Name1 = *. the ADS
 the SET Name2 = GM_RSSPI *
 the SET Name3 = Equipment's *
 the SET Name4 = Protocols * 

REM set the output file name 
the SET FileName = AswRelease. MD5 

REM delete the file 
del % FileName% 

REM MD5 value of the output file type Name1 
for %% in F. (% Name1%) do ( ^
     :: Get value md5 
    %% F. -hashfile the certutil the mD5> APP_MD5_TXT
     setlocal enabledelayedexpansion
     SET index = 0
     the REMtokens delims introduce http://blog.sina.com.cn/s/blog_6a7839530102uvx8.html 
    for / f "tokens = * delims =" %% i in (APP_MD5_TXT) do ( ^
         :: echo %% i 
        IF ! index! . 1 == ( SET md5 = %% I) 
          SET / index = index +. 1 a 
    ) :: !! CHO md5 del APP_MD5_TXT the REM removed md5 spaces, the spaces appear compatible md5 case SET md5 = md5:! = ! echo the current file MD5:!! MD5 echo %% F 1 MD5 >>!! % FileName%
 )
 REM output file type Name2 MD5 value for %% F in (% Name2%) do (
    
    

    
    
    
    
    
    
^
     :: Get value md5 
    the certutil %% F. -Hashfile the MD5> APP_MD5_TXT
     setlocal enabledelayedexpansion
     SET index = 0
     for / F "tokens = * delims =" %% I in (APP_MD5_TXT) do ( ^
         :: echo %% I 
        IF ! Index ! ==. 1 ( SET md5 = %% I) 
          SET / index = index +. 1 a 
    ) :: !! CHO md5 del APP_MD5_TXT the REM removed md5 spaces, the spaces appear compatible md5 case SET ! md5 = md5: = ! echo the current file MD5:!! MD5 echo !! %% F 2 MD5 >> % FileName%

    
    

    
    


    
    
    )
 The REM Output Name3 types of document MD5 value 
for %% in F. (% Name3%) do ( ^
     :: Get value md5 
    the certutil -hashfile %% F. MD5> APP_MD5_TXT
     setlocal enabledelayedexpansion
     SET index = 0
     for / F "tokens = * delims = "%% I in (APP_MD5_TXT) do ( ^
         :: echo %% I 
        IF ! index! ==. 1 ( SET MD5 = %% I) 
          SET / index = index +. 1 A 
    ) :: CHO! MD5! del APP_MD5_TXT REM without removing md5 spaces, but spaces are compatible md5 set
    
    

    
    = MD5 MD5:! = ! 


    echo current file MD5:! MD5! 
    
    echo %% F. MD5. 3 >>!! % FileName%
 )
 the REM output Name4 types of document MD5 value 
for %% in F. (% Name4%) do ( ^
     :: Get value md5 
    the certutil %% F. -hashfile the mD5> APP_MD5_TXT
     setlocal enabledelayedexpansion
     SET index = 0
     for / F "tokens = * delims =" %% I in (APP_MD5_TXT) do ( ^
         :: echo %% I 
        IF ! index! . 1 == ( SET MD5 = %% I) 
          SET / index = index + A. 1 
    )
    :: CHO md5!! 
    Del APP_MD5_TXT
     REM remove the md5 spaces, spaces appear compatible md5 case 
    the SET md5 = md5:! = ! 

    
    Echo the current file MD5:!! Md5 
     REM output does not wrap such as set / p = "hello" <NUL 
    SET / P = F. %%. 4! MD5! <>> NUL % FileName%

 ) PAUSE


    

 

Guess you like

Origin www.cnblogs.com/Summerio/p/11247187.html