Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

Running one file from cd from detachedprogram.

- - - - -

  • Please log in to reply
2 replies to this topic

#1
OCedHrt

OCedHrt

    Newbie

  • Member
  • 41 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.


How to remove advertisement from MSFN

#2
OCedHrt

OCedHrt

    Newbie

  • Member
  • 41 posts
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.

#3
idle.newbie

idle.newbie

    Junior

  • Member
  • Pip
  • 93 posts
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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN