idle.newbie Posted September 5, 2004 Share Posted September 5, 2004 OemPnPDriversPath.cmd@ECHO OFFIF "%1"=="" GOTO EOFIF NOT EXIST %1 GOTO EOFIF "%2"=="" GOTO EOFIF NOT EXIST %2 GOTO EOFSETLOCAL ENABLEDELAYEDEXPANSIONSET OemPnPDriversPath=$SET STDOUT=WINNT.SIFTYPE>%STDOUT% 2>NUL::traverse drivers pathCALL :TRAVERSAL %1ECHO %OemPnPDriversPath:~2%::recreate winnt.sifCALL :RECREATE %2 %STDOUT% Unattended OemPnPDriversPath "%OemPnPDriversPath:~2%"GOTO EOF:TRAVERSALPUSHD %1IF EXIST *.INF SET OemPnPDriversPath=!OemPnPDriversPath!;%CD:~3%FOR /F %%I IN ('DIR /AD /OGN /B') DO ( CALL :TRAVERSAL %CD%\%%I)POPDGOTO EOF:RECREATE::%1=Source, %2=Destination, %3=Section, %4=Key, %5=ValueSET SECTION=NOSET KEY=NOFOR /F "usebackq tokens=1,2*" %%I IN ("%1") DO ( IF "%%J"=="=" ( IF /I "%%I"=="%4" ( ECHO %4 = %5>>%2 SET UPDATED=YES ) ELSE ( ECHO %%I %%J %%K>>%2 ) ) ELSE ( IF /I "%%I"=="[%3]" ( SET SECTION=YES ) ELSE ( IF NOT "%SECTION%"=="NO" ( IF "%KEY%"=="NO" ( ECHO %4 = %5>>%2 SET KEY=YES ) SET KEY=NO ) ) ECHO.>>%2 ECHO %%I>>%2 ))GOTO EOF:EOFIt's a Pyron's SetDevicePath.exe clone in .cmd batch scripting, a modified version of my Detached.cmd. It scans every directories under where you specified, looking for *.inf, and write corresponding OemPnPDriverPath entry into WINNT.SIF.It needs two arguments, #1 full-path to your drivers' directory, #2 your WINNT.SIF.1.copy/extract every drivers to where it should be. eg:XCOPY "C:\UWCD root\$OEM$\$1\Drivers" C:\Driversor7za x Drivers_MassStorage.7z -y -oC:\2.run the script.OemPnPDriversPath.cmd C:\Drivers "C:\UWCD root\i386\WINNT.SIF"note:1.pretty your WINNT.SIF, make sure every "=" between key/value pair has space before/after it. eg:OemPreinstall = YesYou can do this with RegExp capable text editor like EmEditor, replace all "^(\s*;?\s*\w+)\s*=\s*" with "\1 = ".2.do not run this .cmd inside i386, or your WINNT.SIF will be empty, 'cause output WINNT.SIF is on current directory. Link to comment Share on other sites More sharing options...
Bilou_Gateux Posted September 8, 2004 Share Posted September 8, 2004 (edited) great ! nice ! wonderfull !i like cmd scripts.i will keep this one and try it. Works perfect but the name you choose for WINNT.SIF in your example is a bit confusing. OemPnPDriversPath.cmd C:\Drivers "C:\UWCD root\i386\WINNT.SIF"Use 8.3 naming convention for your path and it's more easy.OemPnPDriversPath.cmd C:\Drivers C:\XPCREATE\CDROOT\i386\WINNT.SIF Edited September 9, 2004 by Bilou_Gateux Link to comment Share on other sites More sharing options...
Bâshrat the Sneaky Posted January 28, 2005 Share Posted January 28, 2005 HUH??? Never seen this script before...I guess I'll start using this one in my DriverPacks batch files !!! superb! Link to comment Share on other sites More sharing options...
Bâshrat the Sneaky Posted February 5, 2005 Share Posted February 5, 2005 I can't get this script to work... It DOES give output: I find a new WINNT.SIF file in the current directory, with everything in it except the comments. But unfortunately also without OemPnPDriversPath... How did it work for you Bilou_Gateaux? Link to comment Share on other sites More sharing options...
Bilou_Gateux Posted February 5, 2005 Share Posted February 5, 2005 My %systemdrive% is as described below:$OEM$ dirPnPDrvrs dirUNATTEND.TXT codeOpen command prompt in C:\PnPDrvrs:OEMPnPDriversPath C:\PnPDrvrs C:\$OEM$\UNATTEND.TXTC:\PnPDrvrs\WINNT.SIF content:OemPnPDriversPath = "PnPDrvrs\Display\Intel;PnPDrvrs\Display\NVidia;PnPDrvrs\Hdc\Intel;PnPDrvrs\Media\Fujitsu;***//cut for easy reading//***PnPDrvrs\Net\BRCM;PnPDrvrs\Net\Intel;PnPDrvrs\System\Intel;PnPDrvrs\Usb\Intel" Link to comment Share on other sites More sharing options...
Bâshrat the Sneaky Posted February 5, 2005 Share Posted February 5, 2005 For me it is like this:K:\OemPnPDriversPath.cmdK:\$OEM$\$1\DPK:\I386\winnt.sifAnd OemPnPDriversPath.cmd has to search for devicepaths in K:\$OEM$\$1\DP, adding them to K:\I386\winnt.sif.EDIT: but as I said, it doesn't work... Link to comment Share on other sites More sharing options...
Bilou_Gateux Posted February 5, 2005 Share Posted February 5, 2005 The batch file doesn't direct edit your source WINNT.SIF but recreate a new one wich is saved to the dir where you have saved the batch file.Try first to move the batch file to your DP dir ie K:\$OEM$\$1\DP and then, the resulting new SIF file should be in K:\$OEM$\$1\DP\WINNT.SIF Link to comment Share on other sites More sharing options...
Bâshrat the Sneaky Posted February 5, 2005 Share Posted February 5, 2005 The batch file doesn't direct edit your source WINNT.SIF but recreate a new one wich is saved to the dir where you have saved the batch file.I know that... but the one that I find in the current directory doesn't contain the OemPnPDriversPath... Link to comment Share on other sites More sharing options...
Bilou_Gateux Posted February 5, 2005 Share Posted February 5, 2005 OK i have created the same dir tree as you on my D: partitionD:\$OEM$\$1\PnPDrvrs contains all drivers subdirs and OEMPnPDriversPath.cmdD:\I386 contains the original WINNT.SIFOpen command prompt:cmd /k cd /d D:\$OEM$\$1\PnPDrvrsrun:OEMPnPDriversPath D:\$OEM$\$1\PnPDrvrs D:\I386\WINNT.SIFand check the result (new WINNT.SIF) in D:\$OEM$\$1\PnPDrvrsOemPnPDriversPath = "$OEM$\$1\PnPDrvrs\Display\Intel;$OEM$\$1\PnPDrvrs\Display\NVidia;$OEM$\$1\PnPDrvrs\Hdc\Intel;$OEM$\$1\PnPDrvrs\Media\Fujitsu;$OEM$\$1\PnPDrvrs\Net\BRCM;$OEM$\$1\PnPDrvrs\Net\Intel;$OEM$\$1\PnPDrvrs\System\Intel;$OEM$\$1\PnPDrvrs\Usb\Intel"But the solution is not clean as having the PnP Drivers dir on root of harddrive to build the OemPnPDriversPath = Compare the result with my previous post.I suggest to first build the winnt.sif with your DP dir in root of hard drive and then move to the subdir you want ie $OEM$\$1 Link to comment Share on other sites More sharing options...
Afterdawn Posted February 5, 2005 Share Posted February 5, 2005 Hmm too bad... I thougt your script changed it at runtime! I'm still working on a script that automatically updates the path in the t-39 stage. Thus as a attached program! Actually exactly the same as Pyron's SetDevicePath.exe, but I want it as an cmd-script! Link to comment Share on other sites More sharing options...
Bilou_Gateux Posted February 5, 2005 Share Posted February 5, 2005 The author is idle.newbieYes, it would be fine to dynamically update the WINNT.SIF at T-39. Link to comment Share on other sites More sharing options...
Bâshrat the Sneaky Posted February 5, 2005 Share Posted February 5, 2005 Actually exactly the same as Pyron's SetDevicePath.exe, but I want it as an cmd-script!Why do you want a cmd file so badly, if the executable has been confirmed working by so many? Link to comment Share on other sites More sharing options...
Afterdawn Posted February 5, 2005 Share Posted February 5, 2005 Actually exactly the same as Pyron's SetDevicePath.exe, but I want it as an cmd-script!Why do you want a cmd file so badly, if the executable has been confirmed working by so many? Well, maybe hard to explain, but I'll try: I just like to have something that I know HOW it works. Just out of curiosity, and to be assured that it does what I think it does. Also, I might want to add/modify some things, every now and then. Link to comment Share on other sites More sharing options...
Bâshrat the Sneaky Posted February 5, 2005 Share Posted February 5, 2005 Well, maybe hard to explain, but I'll try: I just like to have something that I know HOW it works. Just out of curiosity, and to be assured that it does what I think it does.I understand you, I'm the same. But if I see that something has been working for hundreds of people, then I'll gladly use it... Link to comment Share on other sites More sharing options...
Afterdawn Posted February 5, 2005 Share Posted February 5, 2005 This script is nice btw, but I'd wonder why he didn't use a utility to update the winnt.sif.That way he could replace the whole :RECREATE routine into this line:nircmd inisetval "d:\xp_unattend\I386\winnt.sif" "Unattended" "OemPnPDriversPath" "~qTHIS_IS_THE_NEW_VALUE~q"http://www.nirsoft.net/utils/nircmd.html Link to comment Share on other sites More sharing options...
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