extract_msu.bat 827 B

123456789101112131415161718192021222324252627282930313233343536
  1. @echo off
  2. @setlocal EnableDelayedExpansion
  3. @set arg=%~1
  4. if [%arg%] == [] (
  5. echo Argument Missing:
  6. echo You must provide a directory that contains
  7. echo all the Windows patches in *.msu format.
  8. echo To Download patches manually, please go:
  9. echo http://mybulletins.technet.microsoft.com/BulletinPages/Dashboard
  10. exit /B
  11. )
  12. if not "!arg:~-1,1!" == "\" (
  13. @set arg=!arg!\
  14. )
  15. for /f %%f in ('dir /B %arg%') DO (
  16. @set fname=%%f
  17. @set lastfourchars=!fname:~-4,4!
  18. if "!lastfourchars!" == ".msu" (
  19. @set newname=!fname:~0,-4!
  20. mkdir %arg%!newname!
  21. mkdir %arg%!newname!\extracted
  22. expand /F:* %arg%!fname! %arg%!newname!
  23. expand /F:* %arg%!newname!\!newname!.cab %arg%!newname!\extracted
  24. )
  25. )
  26. echo Done!
  27. echo Now go to %arg%,
  28. echo and then use the search feature from Windows to
  29. echo find the files you're interested in.