Jump to content

Allow F6, OemPreinstall=No


Recommended Posts

I don't think this has been mentioned yet, but for those who have trouble adding PATA/SATA/RAID controller drivers to your CD you can use this method to manually install the drivers with a floppy and still get the $OEM$ folders copied over.

As some people may be aware, having OemPreinstall=yes will break F6 to install drivers, whereas OemPreinstall=No doesn't.

Cmdlines.txt - This is executed no matter whether OemPreinstall is enabled or not, so we're going to launch a .cmd file from cmdlines.txt.

Open up notepad and paste the following:

@echo off
IF EXIST D:\$OEM$ set CDROM=D:IF EXIST E:\$OEM$ set CDROM=E:IF EXIST F:\$OEM$ set CDROM=F:IF EXIST G:\$OEM$ set CDROM=G:IF EXIST H:\$OEM$ set CDROM=H:IF EXIST I:\$OEM$ set CDROM=I:IF EXIST J:\$OEM$ set CDROM=J:
XCOPY /E /Q %CDROM%\$OEM$\$1 %SYSTEMDRIVE%XCOPY /E /Q %CDROM%\$OEM$\$$ %SYSTEMROOT%XCOPY /E /Q %CDROM%\$OEM$\$Docs "%SYSTEMDRIVE%\Documents and Settings"XCOPY /E /Q %CDROM%\$OEM$\$Progs "%PROGRAMFILES%"
EXIT

Save this as OemPreinstall.cmd in the \$OEM$\ folder.

Add to (or make) a cmdlines.txt file:

[COMMANDS]"OemPreinstall.cmd"

And save in the \$OEM$\ folder.

There is a disadvantage to this method - you cannot use OemPnpDriversPath= to install your drivers as the folders are copied over far too late for Setup to detect and install them.

Link to comment
Share on other sites


When its set as No it won't copy over. But launching the .cmd file from cmdlines.txt looks for the $OEM$ folder on the CD, no matter what driver letter it has, then copies over everything in it to the hard disk (just as OemPreinstall=yes would do)

Link to comment
Share on other sites

I switched my brain on and got it sorted.

I'm just using 2 files : cmdlines.txt and XPtweak.reg

cmdlines.txt has:

[COMMANDS]

"REGEDIT /S XPtweak.reg"

and this works! No need for the .CMD (in my case anyway).

Thanks for all the quick and helpful replies! :)

Link to comment
Share on other sites

  • 1 year later...

Anyone else re-finding this old thread may be interested in this more robust example for the batch file.

OemPreinstall.cmd

@CMDOW.EXE @ /HID 2>NUL||@ECHO OFF
SETLOCAL ENABLEEXTENSIONS
FOR %%? IN (C 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 /I "%%?:" NEQ "%SYSTEMDRIVE%" CALL :SUB "%%?:" &&GOTO START)
GOTO ENDIT

:START
IF EXIST %MYOEM%\$1 XCOPY %MYOEM%\$1 %SYSTEMDRIVE% /S/I/Q/Y >NUL
IF EXIST %MYOEM%\$$ XCOPY %MYOEM%\$$ %SYSTEMROOT% /S/I/Q/Y >NUL
IF EXIST %MYOEM%\$Docs XCOPY %MYOEM%\$Docs "%ALLUSERSPROFILE%\.." /S/I/Q/Y >NUL
IF EXIST %MYOEM%\$Progs XCOPY %MYOEM%\$Progs %PROGRAMFILES% /S/I/Q/Y >NUL

:ENDIT
ENDLOCAL &GOTO :EOF

:SUB
IF NOT EXIST %~1\$OEM$ EXIT/B 1
SET "MYOEM=%~1\$OEM$"
EXIT/B 0

It should be okay run as is without alteration.

Link to comment
Share on other sites

@Yzöwl, depending on your posts I see you using either:

FOR %%? IN ('MOUNTVOL^|FIND ":\"') DO  ...

Or

FOR %%? IN (C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO ...

And now adding this nice CALL :SUB "%%?:" &&GOTO START trick to the later.

Are you researching for the best way to do it or is there specific reasons for picking up this or that method?

Link to comment
Share on other sites

Well, I'm glad you asked!

NO, I still prefer MOUNTVOL, it is however not guaranteed to pick up on every drive.

Because everyone is using the (A B C... version, and that method is the one used in 'The Guide' I thought it more prudent to not confuse things.

What this method actually does is, hopefully, run through the letters one at a time as usual, but, when it finds a match it breaks out of the loop. If therefore the CD-ROM is at drive H, the loop doesn't continue to look for I:\$OEM$, J:\$OEM$..., Z:\$OEM$.

It is also 'more robust' because:

  • If CMDOW is either in PATH or local to the batch it will hide the window, if it isn't then echoing is turned off. Obviously if the window is hidden, then echoing doesn't matter.
    It doesn't prevent the remote possibility of a CD-ROM on C:, but will not search whatever is appointed as the System Drive.
    It doesn't set a variable to the CDROM drive, when it isn't needed.
    It will only copy the contents of the $OEM$ folders if they are there, and in that case, if the window isn't hidden, you will not get a screen output of how many files were copied.
    If you have already redirected your profile directories using winnt.sif or other method, then it doesn't limit the location of those files to the System Drive.

Link to comment
Share on other sites

Yes I'm really impressed.

I loved that "%ALLUSERSPROFILE%\.." and your first line as much as your "PUSHD %OEM%||PUSHD %SYSTEMDRIVE%" in another thread.

Batch scripting can be a bit harsh, but you know how to put oil in it. :thumbup

Link to comment
Share on other sites

  • 2 years later...
  • 4 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...