@echo off

Set WD=%~1

echo.
echo   z-KeepPrefSVC

echo     ᯠ뢠 svcpack.inf  ୨樨
set file=svcpack.inf
expand -r "%I386%\svcpack.in_" "%I386%\%file%">nul

echo      䠩 _SetupHotfixes.cmd
if exist "%I386%\SVCPACK\_SetupHotfixes.cmd" del "%I386%\SVCPACK\_SetupHotfixes.cmd"
"%WD%\..\..\GETSect.exe" "%I386%\%file%" SetupHotfixesToRun >"%I386%\SVCPACK\SetupHotfixes.cmd"
1>"%I386%\%file%.mod" findstr /v /g:"%I386%\SVCPACK\SetupHotfixes.cmd" "%I386%\%file%" || goto :Error
echo hidcon.exe %%24%%\_SetupHotfixes.cmd>>"%I386%\%file%.mod"
copy /y "%I386%\%file%.mod" "%I386%\%file%">nul
del "%I386%\%file%.mod"
del /q "%I386%\svcpack.in_"
MakeCab "%I386%\%file%" "%I386%\svcpack.in_">nul
del /q "%I386%\%file%"

echo     ਢ  ࠡᯮᮡ  䠩 _SetupHotfixes.cmd
set file=SetupHotfixes.cmd

echo     ᫨    ᪮ १ .cmd -  ४ 
for /f "usebackq delims=" %%a in ("%I386%\SVCPACK\%file%") do (
  SETLOCAL EnableDelayedExpansion
  set str=%%SrcDosPath%%\I386\SVCPACK\%%a
  for /f "usebackq delims=" %%i in (`"echo %%a|findstr /ilc:".cmd""`) do set "str=start "" /wait %%SrcDosPath%%\I386\SVCPACK\%%a"
  >>"%I386%\SVCPACK\_%file%" echo !str!
)
echo.
goto :EOF


:Error
echo      ਡ㤨⢥   SVCPACK   ⠭  -13
del /q "%I386%\SVCPACK\SetupHotfixes.cmd"
del /q "%I386%\svcpack.inf.mod"
del /q "%I386%\svcpack.inf"

