Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 


Sign in to follow this  
OCedHrt

Running one file from cd from detachedprogram.

Recommended Posts

DetachedProgram=".\system32\cmd.exe"
Arguments="/C START FOR /F usebackq %I IN (`FINDSTR dospath %SystemRoot%\SYSTEM32\$WINNT$.INF`) DO FOR %J IN (%I$OEM$\Files\Drivers.exe) DO IF NOT %J==dospath (FOR %K IN (%J=EXIT) DO IF NOT %K==EXIT (%K -y /q /r:n -o%SystemRoot%\Temp) ELSE (IF NOT %J==Arguments %K))"

Drivers.exe is my 7-zip archive and -olocation is where it is extracted to.

Don't forget to update your OemPnPDriversPath.

I haven't tested this with an actual installation but this command does work in a command prompt.

The commands (START FINDSTR FOR IF) used here also work when called from a BAT file using cmd.exe and /C START from DetachedProgram so this should work, unless there is a length limit on Arguments and this exceeds it. It is quite long.

Please post with your experiences :)

Update: Ok I have found a problem with this and am working on it :rolleyes:

Update #2: Ok, extracting now works. The problem is that it will also try to run:

"/C$OEM$\Files\$OEM$.exe EXIT -y /q /r:n -oC:\WINDOWS\Temp

Thats not a valid path though so shouldn't be a problem.

Actually, after some thinking, this can be used to run more than one program from cd using DetachedProgram during T-39. There could be a text file on the cd with the filenames of the programs to run and use another FOR statement to parse it and run them.

Share this post


Link to post
Share on other sites

To run multiple files:

DetachedProgram=".\system32\cmd.exe"
Arguments="/C START FOR /F usebackq %I IN (`FINDSTR dospath %SystemRoot%\SYSTEM32\$WINNT$.INF`) DO FOR %J IN (%I$OEM$\Files\commands.txt) DO IF NOT %J==dospath (FOR %K IN (%J=EXIT) DO IF NOT %K==EXIT (FOR /F %L IN (commands.txt) DO %L) ELSE (IF NOT %J==Arguments %K))"

Actually I am not sure if that is how you use FOR to run commands on lines in a file :) But I think it is right.

A more cleaned up version could be:

DetachedProgram=".\system32\cmd.exe"
Arguments="/C START FOR /F usebackq %I IN (`FINDSTR dospath %SystemRoot%\SYSTEM32\$WINNT$.INF`) DO FOR %J IN (%I$OEM$\Files\commands.txt) DO IF NOT %J==dospath (IF NOT %J==Arguments) FOR %K IN (%J) DO %K

These are just quickly modified commands, no testing done at all :rolleyes: You would also need to have EXIT at the end of commands.txt for the 2nd one.

Share this post


Link to post
Share on other sites

i386\WINNT.SIF:

[GuiUnattended]
   DetachedProgram = ".\system32\cmd.exe"
   Arguments="/Q /C FOR /F %I IN (%SystemRoot%\system32\$winnt$.inf) DO (FOR %J IN (%I$OEM$\Detached.cmd) DO (IF EXIST %J (START /MIN %J)))"

$OEM$\Detached.cmd:

@ECHO OFF
::change CurrentDirectory to where script is
CD /D "%~dp0"
::extracting $$ into SystemRoot
.\$$.exe -y -o"%SystemRoot%"
.\$1.exe -y -o"%SystemDrive%"
::extracting Intel INF
.\DRV\IntelINF.exe -y -o"%SystemRoot%\INF"
::extracting RyanVM SATA/Raid drivers repacked
.\DRV\RaidDRV.exe -y -o"%SystemDrive%\DRV"
::extracting drivers sfx
.\DRV\DRV_SFX.exe -y -o"%SystemDrive%\DRV"
EXIT

Tested and confirmed.

Works even with OemPreinstall=No, everything executes on disc. $OEM$\$$ and $OEM$\$1 compressed with 7zip console SFX, no textmode copying needed. Also works on multi boot/source disc.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...