skrypt do integracji offline tylko poprawek ldr.txt

(2 KB) Pobierz
@echo off



REM

REM update.cmd for LDR updates

REM


        set Work_Folder=D:\M7W\Hotfix
	set Option=/image:"D:\M7W\Mount"




rem use the following line for an offline image at D:\M7W\Mount

rem	set Option=/image:"D:\M7W\Mount"









rem

rem program start !! caution: folder cab_dir will be deleted !!

rem

	cd %~dp0

	set LDR_dir=%Work_Folder%

	set cab_dir=%LDR_dir%\cab

	set unpacked=%cab_dir%\unpacked



	IF     EXIST "%cab_dir%"     rd /s /Q "%cab_dir%"



rem

rem wait for RMDIR to finish

rem 



echo       Wait for RMDIR to finish

echo.

echo       If you have to wait for long the folder 

echo       "%cab_dir%" 

echo       is in use (cancel cmd and start again)

echo.



:try_again

	IF     EXIST "%cab_dir%"     goto     try_again



	IF NOT EXIST "%cab_dir%"     md       "%cab_dir%"

	IF NOT EXIST "%unpacked%"    md       "%unpacked%"





ECHO ======================================================================

ECHO Extracting msu files



	if exist "%LDR_dir%\*.msu" expand -f:*.cab "%LDR_dir%\*.msu" "%cab_dir%" >nul



rem wsusscan not needed

	if exist "%cab_dir%\wsusscan.cab" del "%cab_dir%\wsusscan.cab" /f /q >nul





ECHO ======================================================================

ECHO Copying cab files



	if exist "%LDR_dir%\*.cab" xcopy  "%LDR_dir%\*.cab" "%cab_dir%" /y >nul







ECHO ======================================================================

ECHO Extracting cab files



	FOR /F "tokens=*" %%A IN ('DIR /B "%cab_dir%\*.cab"') DO (

		ECHO Extracting %%A

		MKDIR "%unpacked%\%%A"

		expand -f:* "%cab_dir%\%%A" "%unpacked%\%%A" >nul

	)





ECHO ======================================================================

ECHO Installing LDR updates

	setlocal enabledelayedexpansion

	set number_of_updates=0

	set install_updates=0

	



	FOR /F "tokens=*" %%A IN ('DIR /B /A:D "%unpacked%\*"') DO (

		IF EXIST "%unpacked%\%%A\update-bf.mum" set /a number_of_updates+=1

	)

	

	FOR /F "tokens=*" %%A IN ('DIR /B /A:D "%unpacked%\*"') DO (

		IF EXIST "%unpacked%\%%A\update-bf.mum" (

			set /a install_updates+=1

			ECHO Installing %%A     update:!install_updates! of %number_of_updates%

			dism %option% /LogPath:"%~dp0DISM.log" /loglevel:2 /Add-Package /PackagePath:"%unpacked%\%%A\update-bf.mum" /NoRestart 

		)

		IF EXIST "%unpacked%\%%A" rd /S /Q "%unpacked%\%%A"

	)



	setlocal disabledelayedexpansion



ECHO ======================================================================	





	IF EXIST "%cab_dir%" rd /s /Q "%cab_dir%"



	echo.

	echo ###########################################################

	echo.
        echo    LDR updates are installed
        pause
Zgłoś jeśli naruszono regulamin