I'm sorry for the delay. I've been away.
It looks like NAME should work in your revised code for the instances where you have it defined. The only problem I see is when files are found that don't match your file name checks. This is easily solved with a single line of code, set "NAME=%%f", in the right place as shown in the new code below.
Also, most of the files we are looking for end with ".exe". The
If statements can be rearranged to simplify the code by writing the check for ".exe" only once. This makes the code far more efficient when a file does not end with ".exe" by reducing the number of checks these files need to go through.
EDIT: I forgot to make the changes you mentioned in your last reply. Fixed.
SETLOCAL EnableDelayedExpansion
echo.
echo Adding registry tweaks to enable RunOnceEx for install SPECIAL Updates...
echo.
REG LOAD HKLM\Slipstream "%WIM%\Windows\System32\Config\Software" >nul
SET ROE=HKLM\Slipstream\Microsoft\Windows\CurrentVersion\RunOnceEx
REG ADD %ROE% /v TITLE /d "Installing updates..." /f >nul
REG ADD %ROE% /v Flags /t REG_DWORD /d "00000014" /f >nul
REG ADD %ROE% /d "%WinDir%\System32\rundll32.exe %WinDir%\System32\iernonce.dll,RunOnceExProcess" /f >nul
cd SpecialUpdates
set /a NUM=0
if not exist "%WIM%\Windows\Setup\Updates" mkdir "%WIM%\Windows\Setup\Updates" >nul
FOR %%f IN ("*.*") DO (
set /a ROENUM=!NUM!*5
If !ROENUM! LSS 10 (set "ROESTR=00!ROENUM!") ELSE (
If !ROENUM! LSS 100 (set "ROESTR=0!ROENUM!") ELSE (
set "ROESTR=!ROENUM!"))
copy /Y "%%f" "%WIM%\Windows\Setup\Updates" >nul
set "SWITCH=/q"
set "NAME=%%f"
set "FILENAMECHECK=%%f"
if /I "!FILENAMECHECK:~-4!"==".exe" (
if /I "!FILENAMECHECK:~0,7!"=="DirectX" (
set "SWITCH=/Q /T:\"%WinDir%\Setup\Updates\DX\" /C:\"%WinDir%\Setup\Updates\DX\dxsetup.exe /silent\""
set "NAME=DirectX SDK")
if /I "!FILENAMECHECK:~0,15!"=="GamesForWindows" (
set "NAME=Games for Windows - LIVE")
if /I "!FILENAMECHECK:~0,11!"=="Silverlight" (
set "NAME=Microsoft Silverlight")
if /I "!FILENAMECHECK:~0,16!"=="windows-kb890830" (
set "NAME=Malicious Software Removal Tool")
if /I "!FILENAMECHECK:~0,7!"=="wlsetup" (
set "SWITCH=/silent"
set "NAME=Windows Live Essentials")
)
if /I "!FILENAMECHECK:~0,11!"=="PlayReadyPC" (
if /I "!FILENAMECHECK:~-4!"==".msi" (
set "SWITCH=/quiet /norestart"
set "NAME=PlayReady PC Runtime"))
REG ADD %ROE%\!ROESTR! /ve /d "!NAME!" /f >nul
REG ADD %ROE%\!ROESTR! /v "!NAME!" /d "%WinDir%\Setup\Updates\%%f !SWITCH!" /f >nul
set /a NUM+=1
)
REG ADD %ROE%\999 /ve /d "Cleaning up..." /f >nul
REG ADD %ROE%\999 /v CMD /d "cmd.exe /q /c RmDir /S /Q \"%WinDir%\Setup\Updates\"" /f >nul
echo.
REG UNLOAD HKLM\Slipstream >nul
cd..
Edited by 5eraph, 20 January 2010 - 08:15 PM.