Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.3 KiB

  1. @echo off
  2. setlocal
  3. set cab=%1
  4. set cab=%cab:"=%
  5. path %~dp0;%path%
  6. if not exist "%cab%" goto :EOF
  7. if exist $$temp$$ del $$temp$$
  8. listcab "%cab%" /out:$$temp$$
  9. if not exist $$temp$$ goto :EOF
  10. del $$temp$$
  11. set zone="%cab%.int"
  12. if not exist %zone% goto gotzone
  13. set /a z=0
  14. :next
  15. set /a z=%z% + 1
  16. set zone="%cab%.int%z%"
  17. if exist %zone% goto next
  18. :gotzone
  19. rd %zone% /s /q 2>nul
  20. md %zone%
  21. %SystemRoot%\system32\expand.exe -r -F:* "%cab%" %zone%
  22. set KeepDirectory=0
  23. set BatchName=%~dpnx0
  24. for /f "delims=?" %%f in ('dir %zone% /s /b /a-d') do call :PerFile "%cab%" "%%f"
  25. if %KeepDirectory%==0 rd %zone% /s /q 2>nul
  26. if not exist "%cab%" echo Missing 1: "%cab%"
  27. goto :EOF
  28. :PerFile
  29. set file=%2
  30. set file=%file:"=%
  31. if not exist "%file%" echo Missing 2: "%file%"
  32. for %%k in (%file%) do set base=%%~nxk
  33. if exist "%base%" goto :Existing
  34. if /i %~x2.==.cab. call :Nested %1 %2
  35. if not exist "%file%" echo Missing 3: "%file%"
  36. if exist "%file%" move "%file%" .
  37. goto :EOF
  38. :Existing
  39. if not exist "%file%" echo Missing 4: "%file%"
  40. comp1 "%base%" "%file%" >nul
  41. if errorlevel 1 goto :Different
  42. del "%file%"
  43. goto :EOF
  44. :Different
  45. set KeepDirectory=1
  46. if /i %~x2.==.cab. call :Nested %1 %2
  47. goto :EOF
  48. :Nested
  49. set KeepDirectory=1
  50. echo Nesting %BatchName% for %2...
  51. call %BatchName% %2
  52. echo ...done with nesting %2
  53. goto :EOF