Board logo

标题: [注册表类] [分享]批处理提取系统中软件注册表 [打印本页]

作者: ptsdy    时间: 2012-11-18 14:01     标题: [分享]批处理提取系统中软件注册表

  1. @echo off
  2. echo 南无七俱胝佛母大圣准提王菩萨 !!!
  3. echo 南无七俱胝佛母大圣准提王菩萨 !!!
  4. echo 南无七俱胝佛母大圣准提王菩萨 !!!
  5. echo Made by ptsdy !!!
  6. :regstart
  7. set time1=%time%
  8. echo Please  input  progresse  names in regedit!
  9. echo Example:TTPlayer TTPlayer.exe Goto Goto.exe
  10. set /p pro=progress names:
  11. if not defined pro (cls  & echo No progress names!
  12.                    echo Errors! Please input again!
  13.                    goto :regstart)
  14. if not exist win.reg (
  15.      echo Please export system regfile !!!
  16.      echo press anykey and exit !  
  17.      pause >nul & exit) else (
  18.      if not exist win.txt (   
  19.           type win.reg >win1.txt
  20.           (findstr /i /n .* win1.txt >win1a.txt
  21.           findstr /i /n .* win1a.txt >win.txt
  22.           ) && del /f /q win1*.txt >nul 2>nul
  23.         )
  24.      )
  25. rem
  26. (type win.txt | findstr /i "%pro%" 2>nul) >soft.txt
  27. set /p regver=<win.txt
  28. set regver=%regver:~4%
  29. echo %regver% >soft_reg.txt
  30. echo.>>soft_reg.txt
  31. rd /s /q tmp 2>nul & md tmp 2>nul
  32. echo It's will take a few minutes !!!
  33. echo Please wait to the end !!!..........................
  34. setlocal enabledelayedexpansion
  35. for /f  "tokens=1,2,* delims=:" %%h in (soft.txt) do (
  36.     if not exist "%~dp0tmp\%%h.tmp" (
  37.        cd.>"%~dp0tmp\%%h.tmp"      
  38.        set "a=%%h"
  39.        set "a1=%%h"
  40.        set "an=%%h%"
  41.        set "b=%%j"
  42.        set "b1=%%j"
  43.        set "b=!b:~1,1!"
  44.        set "bn=!b1:~2,1!"
  45.        setlocal
  46.        call :regup "!b!"
  47.        endlocal
  48.        setlocal
  49.        call :regdown
  50.        endlocal      
  51.        )
  52.     )
  53. endlocal
  54. rd /s /q tmp
  55. echo Start Time1:%time1%
  56. echo  End  Time2:%time%
  57. echo .........................The end !!!
  58. pause
  59. goto eof
  60. :regup
  61. if /i "%~1" equ "H" if "!bn!" equ "K" goto eof
  62. set str=
  63. for /l %%p in (1,1,20) do (
  64.      set /a a-=1     
  65.      set "str=!str! !a!:!a!: "
  66.      )
  67. (type win.txt | findstr /i "!str!" 2>nul) >"%~dp0tmp\regtmp.txt"
  68. for /r "%~dp0tmp\" %%g in (regtmp.txt) do if "%%~zg" equ "0" goto eof
  69. :regup1
  70. set /a an-=1
  71. (type "%~dp0tmp\regtmp.txt" | findstr /i "!an!:!an!:" 2>nul) >"%~dp0tmp\regtmp1.txt"
  72. for /f  "usebackq tokens=1,2,* delims=:" %%u in ("%~dp0tmp\regtmp1.txt") do (
  73.     if "%%w" neq "" (
  74.        echo.%%w >"%~dp0tmp\!an!.txt"
  75.        if not exist "%~dp0tmp\%%u.tmp" (
  76.           cd.>"%~dp0tmp\%%u.tmp"                    
  77.           ) else goto eof         
  78.        ) else (
  79.        for /l %%a in (!an!,1,!a1!) do (
  80.            (type "%~dp0tmp\%%a.txt" >>soft_reg.txt) 2>nul
  81.            )      
  82.        goto eof
  83.        )
  84.    )
  85. if "!an!" equ "!a!" goto :regup
  86. goto :regup1
  87. goto eof
  88. :regdown
  89. if "!a1!" equ "!a!" echo.!b1! >>soft_reg.txt
  90. set str=
  91. for /l %%p in (1,1,20) do (
  92.      set /a a+=1
  93.      set "str=!str! !a!:!a!: "
  94.      )
  95. (type win.txt | findstr /i "!str!" 2>nul) >"%~dp0tmp\regtmp.txt"
  96. for /r "%~dp0tmp\" %%g in (regtmp.txt) do if "%%~zg" equ "0" goto eof
  97. :regdown1
  98. set /a an+=1
  99. (type "%~dp0tmp\regtmp.txt" | findstr /i "!an!:!an!:" 2>nul) >"%~dp0tmp\regtmp1.txt"
  100. for /f  "usebackq tokens=1,2,* delims=:" %%m in ("%~dp0tmp\regtmp1.txt") do (
  101.     if "%%o" neq "" (
  102.        echo.%%o >>soft_reg.txt
  103.        if not exist "%~dp0tmp\%%m.tmp" (
  104.           cd.>"%~dp0tmp\%%m.tmp"         
  105.           ) else goto eof
  106.        ) else (
  107.        echo.>>soft_reg.txt
  108.        goto eof
  109.        )
  110.    )
  111. if "!an!" equ "!a!" goto :regdown
  112. goto :regdown1
  113. goto eof
  114. :eof
复制代码
挖空心思,绞尽脑汁做了这个批处理!
做的过程中有抓狂的感觉!好不容易做出来了。感恩佛母!
执行时和导出的注册表文件放在一个目录里。
请各位网友提出指导意见!
作者: apang    时间: 2012-11-18 18:43

楼主用好多临时文件,呵呵




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