n7Epsilon Posted June 2, 2005 Posted June 2, 2005 Hi, I have always used my CD using the $OEM$ folders and etc. but I discovered something... I don't use any DriverPacks or hacked files, so I am trying to get rid of the $OEM$ distribution folders....--> The reason: WINNT.SIF not being executed when setup is launched by WINNT32.EXE, and I would like to retain the ability to install using this method (useful for BartPE...)---> So, I am trying to migrate the RunOnceEx.cmd code to a CMD file that gets executed by SVCPACK.INF ....--> My only problem is that I cannot create the %SRCPATH% variable that contains the source of the installation files ....--> In $OEM$ distribution folders, when RunOnceEx.cmd is executed, Windows makes the current folder %CDletter%\$OEM$, so if I use relative paths in the batch file, RunOnceEx.cmd becomes independent of the CD-ROM drive letter and I can install Windows XP UA from the CD or the hard drive, but if I use the normal CD-ROM detection code:FOR %%i IN (D E F G H I J K L M N O P Q R S T U V W X Y Z) Do if exist %%i:\BootCD.dat set SRCPATH=%%i:- RunOnceEx will always require installing from the CD-ROM since when installing from the hard drive the paths will get messed up and none of my customization will be executed...---> So now, I migrated the code the SVCPACK.INF, but the problem is:--> When SVCPACK.CMD launches, the current directory is %WinDir%\SYSTEM32\inetsrv, not %SRCPATH%\i386\svcpack, so I cannot use relative paths anymore....--> So I thought of a workaround ::--> If Windows stores the location of its installation source in the registry I can implement the following code:reg QUERY "%REGKEY%" /v "%VALUE%" | find ":" > %PP%\fndsrc.tmpFOR /F "usebackq delims=," %%i IN (`type %PP%\fndsrc.tmp`) DO set SRCPATH=%%iset SRCPATH=%SRCPATH:~33,-1%%SRCPATH:~,2%cd %SRCPATH%- So I can change the directory to %SRCPATH%\ so I can use relative paths again...--> But problem is I cannot find the registry key that points to Windows Source Paths...- 2 keys I tried ...HKLM\Software\Microsoft\Windows NT\CurrentVersion- There is a REG_SZ value called SourcePath that I tried, but I found out that this value isn't written to the registry until SETUP ends so I cannot use that ....HKLM\Software\Microsoft\COM3\Setup- There is a REG_SZ value called "Source Path", but the problem is that it works fine when booting from CD, otherwise it is changed to C:\WINNT????.~LS folder (?? I cannot remember the name) when installing from WINNT32.EXE or WINNT.EXE, so I cannot use that ...- 1 key still not tried...HKLM\Software\Microsoft\Windows\CurrentVersion\Setup - There is a REG_SZ value called "ServicePackSourcePath" that is pointing to the location of the Setup files, but I don't know, will that key exist during SETUP... ???-- Can I modify SETUPREG.HIV to add such a key.. I so how, and what should I enter .....---> Sorry for lengthy post, but I try to include as much detail to what I'm doing as possible....-- NOTE: WXP SP2 + RyanVM Update Pack 1.2.2 a FULL + Gnome's WMP10 Slipstreamer....--> Feedback appreciated.....
erik_demon Posted June 3, 2005 Posted June 3, 2005 (edited) Hey I can't help you with your workaround because I know to little about about this .I can however help you with this:--> The reason: WINNT.SIF not being executed when setup is launched by WINNT32.EXE, and I would like to retain the ability to install using this method (useful for BartPE...)When you install from a CD, winnt.sif is used standard as your answer file. When you install with winnt.exe or winnt32.exe this is not the case, you need to specify the path. I have renamed my winnt.sif to unattended.txt I install form a second harddrive, and there my driver strucutre looks like this:D:\|---------->WINXP |-----------------i386 |-----------------$OEM$my unattended.txt is in the WINXP folderThis is how I start my installation:set AnswerFile=D:\WINXP\unattended.txtset SetupFiles=D:\WINXP\I386%SetupFiles%\winnt32.exe /s:%SetupFiles% /unattend:%AnswerFile% /tempdrive:C /syspart:CAlso note that if you install with winnt.exe or winnt32.exe, your $OEM$ folder has to be inside the i386 folderHope this helps!EDIT: For more info about winnt32.exe go to the i386 folder and open winnt32.hlp Edited June 3, 2005 by erik_demon
n7Epsilon Posted June 5, 2005 Author Posted June 5, 2005 (edited) Hi,--> I have managed to create this batch file that can read and process each separate line from a REG_MULTI_SZ variable, here is the source code, took me about 2 hours to fully test....--> However it depends on 2 external programs that need to somehow be copied to %SystemRoot%\System32 before T-14 (SVCPACK.INF)...--> Programs are: 1. Linex.com (extracts individual lines from stdout of a command) 2. Windows Global Search and Replace (GSAR.EXE)-> Can someone please examine my source and see if it can be optimized...--> Can I replace these commands by Windows-native programs .....To Test:--------- Download attachment, unzip to a separate folder and double-click TEST.CMD to execute....@Echo OffREMREM -- Created by n7Epsilon @ MSFN.ORGREM - Feel free to incorporate into your batch filesREM but just don't remove these non-intrusive remark lines...REMEcho.Echo *** Read HKLM\Software\Microsoft\Windows\CurrentVersion\SetupEcho *** Read "Installation Sources" REG_MULTI_SZ value and processEcho each line individually...Echo.Echo.Echo ** Press any key to start ...PAUSE > NULEcho.Echo ** Looking for Windows XP installation source ...reg QUERY "HKLM\Software\Microsoft\Windows\CurrentVersion\Setup" /v "Installation Sources" | find ":" > %TEMP%\fndsrc.tmpgsar -s:x5C:x30 -r:x0D:x0A -o %temp%\fndsrc.tmp > NULgsar -sInstallation:x20Sources -r -o %temp%\fndsrc.tmp > NULgsar -sREG_MULTI_SZ -r -o %temp%\fndsrc.tmp > NULgsar -s:x20:x20:x20:x20:x09:x09 -r -o %temp%\fndsrc.tmp > NULgoto process:processfind /C ":" %Temp%\fndsrc.tmp > %temp%\no.xxgsar -s:x0D:x0A -r -o %temp%\no.xx > NULfor /F "usebackq delims=," %%i IN (`type %temp%\no.xx`) DO set loops=%%iset loops=%Loops:~-2%del %temp%\no.xxgoto loopstart:loopstartset fndcnt=0:loopIf exist %temp%\work.ctl del %temp%\work.ctl > NULset srctest=If not "%SRCPATH%"=="" goto srcpathsetIf "%fndcnt%"=="%loops%" goto loopfailset /A fndcnt=%fndcnt%+1linex %fndcnt% < %temp%\fndsrc.tmp > %temp%\work.ctlFOR /F "usebackq delims=," %%i IN (`type %temp%\work.ctl`) DO set srctest=%%iset srcstbx=%srctest:~-1%Echo %srcstbx% | find "\" > NULIf not errorlevel=1 set srctest=%srctest:~0,-1%If exist %srctest%\WIN51IP.SP2 set SRCPATH=%SRCTEST%goto loop:loopfailset fndcnt=set loops=Echo.Echo !!!- Error: Unable to read Windows XP installationEcho !!!- files source path from the registry...Echo.goto end:srcpathsetset fndcnt=set loops=Echo.Echo ** Windows Installation Source Folder:Echo * %SRCPATH%Echo.goto end:endset srcstbx=PAUSETEST.zip Edited November 3, 2005 by ChipCraze23
Bilou_Gateux Posted February 4, 2006 Posted February 4, 2006 (edited) Hi,--> I have managed to create this batch file that can read and process each separate line from a REG_MULTI_SZ variable, here is the source code, took me about 2 hours to fully test....--> However it depends on 2 external programs that need to somehow be copied to %SystemRoot%\System32 before T-14 (SVCPACK.INF)...--> Programs are: 1. Linex.com (extracts individual lines from stdout of a command)2. Windows Global Search and Replace (GSAR.EXE)-> Can someone please examine my source and see if it can be optimized...--> Can I replace these commands by Windows-native programs ..... fndsrc.tmp output before removing with gsar.exe unwanted chars x5C (Reverse Solidus) and x30 (Digit Zero) at end of fndsrc.tmpD:\fsc.tmp\driver\sound\ad_1986_v5_12_01_5170_w2k_wxp\SMAXWDM\W2K_XP\0D:\FSC.TMP\DRIVER\DISPLAY\INTEL_915_PV14_7_0_3889_W2K_WXP\WIN2000\0D:\FSC.TMP\DRIVER\NETWORK\BROADCOM_GIGABIT_V8_22_1_0_NT4_W2K_WXP_X64\0I:\\0\0Only checked on running Windows, not @T13 (SVCPACK.INF)Echo.Echo ** Looking for Windows XP installation source ...FOR /F "TOKENS=3 DELIMS= " %%? IN ('REG QUERY "HKLM\Software\Microsoft\Windows\CurrentVersion\Setup" /v "Installation Sources" ^2^>NUL') DO (IF ERRORLEVEL 0 echo/%%?>%TEMP%\fndsrc.tmp)&(gsar -s:x5C:x30 -r:x0D:x0A -o %TEMP%\fndsrc.tmp >NUL):processfor /f "skip=1 tokens=3 delims= " %%? in ('type %temp%\fndsrc.tmp ^|find /C ":"') do (IF ERRORLEVEL 0 set loops=%%?)i re-use some code (with little modification) posted by Yzöwl MSFN batch expert.@Yzöwl,can give us a solution not to use gsar in the first for /F command to remove the unwanted chars. Edited February 4, 2006 by Bilou_Gateux
Yzöwl Posted February 4, 2006 Posted February 4, 2006 (edited) What is trying to be achieved?Don't get me wrong, I haven't got a problem creating a piece of code to 'split' the MULTI_REG_SZ into its multiple entries, I just dont know why.In the meantime, here is a snippet which will create a text file named tmp_.txt, containing up to 9 strings from the MULTI_REG_SZ data@echo off &setlocal enableextensionsset key="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup"set val="Installation Sources"for /f "skip=1 tokens=3 delims= " %%? in ('reg query %key% /v %val% ^2^>nul') do if errorlevel 0 set "dat=%%?"if not defined dat goto endset "dat=%dat:\0\0=%" &set "dat=%dat:\0=ž%"for /f "tokens=1,2,3,4,5,6,7,8,9 delims=ž" %%a in ("%dat%") do ( for %%? in ("%%a" "%%b" "%%c" "%%d" "%%e" "%%f" "%%g" "%%h" "%%i") do if "%%~?" neq "" echo>>tmp_.txt %%~? ):endendlocal &goto :eofwhere, on line 4, delims=<tab>Hope it helps you out! Edited February 4, 2006 by Yzöwl
Bilou_Gateux Posted February 6, 2006 Posted February 6, 2006 (edited) Thank for help. each time you post a new script, i learn something new.I always forget about the replace function in the SET command.How strange is this char ž Latin Small Letter Z with Caron from the MULTI_REG_SZ data value. Edited February 6, 2006 by Bilou_Gateux
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now