Advertisement
Guest User

Untitled

a guest
Oct 18th, 2016
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. @cls
  3. @setlocal enableextensions enabledelayedexpansion
  4. @CHCP 852 >nul
  5.  
  6. @set /A COUNTER=0
  7. @set "spaces=                               "
  8. @set "katalog=!cd!obrazy"
  9.  
  10. @echo   Lp.      Obraz                                       Plik
  11. @echo.
  12. for /F "tokens=*" %%G in ('dir /a-d /b /s  ^"%katalog%^" ^|find /i ".wim"^') DO (call :do_set1 "%%G")
  13. @if "%COUNTER%"=="0" @goto end
  14. @goto do_set4
  15.  
  16. :do_set1
  17. @set wimfile=%~1
  18. @set wimname=%~nx1
  19. @for /f "tokens=3,* delims= " %%G in ('call dism /get-wiminfo /wimfile:%wimfile%  ^| find /i "index"') do (call :do_set2 "%%G")
  20. @goto end
  21.  
  22. :do_set2
  23. @set index=%~1
  24. @for /f "tokens=3,* delims= " %%G in ('call dism /get-wiminfo /wimfile:%wimfile% /index:%index% ^| find /i "description"') do (call :do_set3 "%%G %%H")
  25. @goto end
  26.  
  27. :do_set3
  28. @set /A COUNTER+=1
  29. @set opis=%~1
  30.  
  31. @set "o%COUNTER%=%opis%"
  32. @set "i%COUNTER%=%index%"
  33. @set "wn%COUNTER%=%wimname%"
  34. @set "w%COUNTER%=%wimfile%"
  35.  
  36. @call :formatout
  37. ::@echo. %COUNTER%   %opis%   %wimname%
  38. @goto end
  39.  
  40. :do_set4
  41. @echo.
  42. @echo.
  43. @SET /P obraz=Kt˘ry obraz zainstalowa†?:  
  44. @echo.
  45. if [!wn%obraz%!]==[] (@echo Nieprawidˆowy wyb˘r.) & @goto end
  46. @echo. Wybrano obraz "!o%obraz%!" z pliku !wn%obraz%!
  47. @echo.
  48. @SET /P wyb=Czy wyb˘r jest prawidˆowy (T czy N)?:
  49. @echo.  
  50. @if /i [%wyb%]==[T] @goto do_set5
  51. @if /i [%wyb%]==[Y] @goto do_set5
  52. @goto end
  53.  
  54. :formatout
  55. @call :padright opis 40
  56. @call :padright wimname 20
  57. @call :padright COUNTER 5
  58. @echo   %COUNTER%    %opis%    %wimname%
  59. @goto :end
  60.  
  61. :padright
  62. @call SET padded=%%%1%%%spaces%
  63. @call SET %1=%%padded:~0,%2%%
  64. @goto end
  65.  
  66. :do_set5
  67. @call install.cmd !w%obraz%! !i%obraz%!
  68. @echo.
  69. @goto end
  70.  
  71. :end
  72. @endlocal
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement