Bilou_Gateux Posted June 30, 2009 Posted June 30, 2009 (edited) I have a directory tree and i would like to replace each file in this tree with the updated file from new service pack (if found).The idea is to replace binaries from SP2 with the same from SP3 but don't touch registry hives.NOTE:I can't use the regular SP3_extracted\i386\update\update.exe from Service Pack to update OS because the target to update is before FBA Windows XP Embedded w/ SP2 run-time image. FBA (First Boot Agent) completes the run-time image build process = setup in a regular Windows XP Professional install (GUI part of install after textmode copy step)i use this script to get a list of all files to replace.SET TARGETROOT=%1FOR /F "USEBACKQ DELIMS==" %%h IN (`DIR /B /AD /S %TARGETROOT%`) DO ( SET SRCPATH=%%h call :loop SET SRCPATH=)goto :eof:loop echo/[%SRCPATH%]>>%temp%\filelist.txtFOR /F "USEBACKQ DELIMS==" %%I IN (`DIR /B /A-D /OGN %SRCPATH%\*`) DO ( echo/%%~nxI>> %temp%\filelist.txt)goto :eoffor each file in the list, i have to check if updated binary exists in SP3_extracted\i386 folder and copy SP3_extracted\i386\%%~nxI to %SRCPATH%filelist.txt[D:\Windows]explorer.exeexplorer.scfhh.exemsdfmap.iniNOTEPAD.EXEregedit.exetwain.dlltwain_32.dlltwunk_16.exetwunk_32.exeWinSetup.log[D:\Windows\AppPatch]AcGenral.dllAcLayers.dllAcLua.dllAcSpecfc.dllAcVerfyr.dllAcXtrnal.dllapphelp.sdbdrvmain.sdbmsimain.sdbsysmain.sdb[D:\Windows\Cursors]...i have a few files exceptions i have to take care before replacing them:if ACPIAPIC_UP ntoskrnl.exe=ntoskrnl.exeif ACPIAPIC_UP hal.exe=halaacpi.dlland a dir exceptionskip D:\Windows\system32\config Edited June 30, 2009 by Bilou_Gateux
Yzöwl Posted June 30, 2009 Posted June 30, 2009 Ignoring the 'if ACPIAPIC_UP' lines, because I have no idea what you mean, here's a basic copy .cmd file which may help:@Echo off&SetlocalIf Exist %1 (Pushd %1) Else Goto :EofSet "X_=X:\Path To\SP3_extracted\i386"For /f "tokens=*" %%# In ( 'Dir/b/s/ad^|Find /v /i "\Windows\System32\config"') Do Call :_T %%#Goto :Eof:_TPushd %*For /f "tokens=*" %%# In ('Dir/b/a-d') Do If Exist "%X_%\%%#" Copy "%X_%\%%#"PopdYou'll need to change 'line 3' to the correct full path!
Bilou_Gateux Posted July 1, 2009 Author Posted July 1, 2009 (edited) Ignoring the 'if ACPIAPIC_UP' lines, because I have no idea what you mean[/iIt's just a reminder. According to hal.inf and CPU, source files are different:ACPIAPIC_UP_HAL, ACPIAPIC_UP ; ACPI APIC-based PC (UP)ACPIAPIC_MP_HAL, ACPIAPIC_MP, ACPIAPIC_UP ; ACPI APIC-based PC (MP);****************************************************; Files common to all x86 MP platforms[MP.CopyFiles]ntoskrnl.exe, ntkrnlmp.exe,,0x3000ntkrnlpa.exe, ntkrpamp.exe,,0x3000[ACPIAPIC_UP_HAL.CopyFiles]hal.dll, halaacpi.dll,,0x3000;****************************************************; Files common to all x86 UP platforms[uP.CopyFiles]ntoskrnl.exe,,,0x3000ntkrnlpa.exe,,,0x3000[ACPIAPIC_MP_HAL.CopyFiles]hal.dll, halmacpi.dll,,0x3000i will probably update both files outside the script.Just noticed files in X:\Path To\SP3_extracted\i386 are compressed, so i have to use an expand -r command instead of copy command. how to change this command:If Exist "%X_%\%%#" Copy "%X_%\%%#"with expand command the source file has the last char of the extension replaced by a "low line" _ char.ie with my previous listif Exist "X:\Path To\SP3_extracted\i386\explorer.exe" expand -r "X:\Path To\SP3_extracted\i386\explorer.ex_" .ie explorer.exe %~nx0 returnexplorer.ex_ %~n0 + 2 characters of extension %~x0 + _ Edited July 1, 2009 by Bilou_Gateux
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now