Jump to content

[TIP] reduce $OEM$ folder size


Recommended Posts

oke here is the deal. you have a lot of installers, and dont want to make 7ziped switchless installers for them,

so dont, just compress your entire OEM folder and let it be copied form cmdlines.txt

my example:

; cmdlines.txt  

[Commands]
"runonceex.cmd"

; runonceex.cmd

@echo off
;setting variables...
SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx
SET PP=%systemdrive%\OEM\

;extracting oem files...
cmdow @ /HID 7za.exe x OEM.7z -o%PP%

;setting required registry settings for component install...
REG ADD %KEY% /V TITLE /D "Installing Additional Components" /f

REG ADD %KEY%\005 /VE /D "Microsoft DirectX 9c" /f
REG ADD %KEY%\005 /V 1 /D "%PP%DX9\dxsetup.exe /silent" /f

REG ADD %KEY%\010 /VE /D "Microsoft .NET Runtimes" /f
REG ADD %KEY%\010 /V 1 /D "%PP%NET\dotnet1.exe " /f
REG ADD %KEY%\010 /V 2 /D "%PP%NET\dotnet2.exe " /f

REG ADD %KEY%\045 /VE /D "Paint . NET v2.6" /f
REG ADD %KEY%\045 /V 1 /D "%PP%paintNET\PaintNET.exe /auto TARGETDIR=%PROGRAMFILES%\PaintNET JPGPNGBMPEDITOR=1 DESKTOPSHORTCUT=0" /f

;cleaning up oem folder and rebooting system...
REG ADD %KEY%\100 /VE /D "Reboot System" /f
REG ADD %KEY%\100 /V 1 /D "rd %PP% /s /q" /f
REG ADD %KEY%\100 /V 2 /D "shutdown.exe /r /t 10" /f

my directory:

[ %CDROOT% ]
\--- [ $OEM$ ]
\------ [ $$ \ system32 ] \ cmdow.exe
| OEM.7z
| cmdlines.txt
| 7za.exe
| runonceex.cmd

//update - corrected a mistake you nead 7za.exe instead of 7z.exe

download HERE

Edited by -I-
Link to comment
Share on other sites


Nice one buit there's a catch: This may reduce size but it will slow you down bigtime...

I'd only use this if I had a CD/DVD that was full and I needed the space...

Link to comment
Share on other sites

simpler to do it at "GuiUnattended" with "DetachedProgram" cause I only been doing that a couple years.

but Ghost82 right, only use that when you exceed the CD size if thats all you have to make use of all that CD space.

But its not that big of a slowdown or at leat at GuiUnattended.

I now have DVD so I don't use personally anymore

Edited by maxXPsoft
Link to comment
Share on other sites

you guys are both right ... it will cause some delay, compared to a complete non-compressed OEM folder. but if you intent to uses 7z.sfx (self-extracting installers). like used in most guide, my method will even slightly improve performance.

i compared extracting the same folder from 1 file of about 250mb (64mb dict size), against about 20 files. (ranging from 2 to 20mb) who by the got my to a final count of 265mb)

in time it decompressing the big file took about 5 seconds less.

(on a dual core 1.8ghz) where using the same 67mb of ram...

but true, copresion is un neaded and undesired if you dont exead the cdrom's drivespace...

ow, and btw i migt have send the wrong message about the 7z version. |

you nead 7za.exe instead of 7z.exe

link to 7za HERE

Link to comment
Share on other sites

you guys are both right ... it will cause some delay, compared to a complete non-compressed OEM folder. but if you intent to uses 7z.sfx (self-extracting installers). like used in most guide, my method will even slightly improve performance.

If you really care about saving as much space as possible, you should have no compressed file inside your big OEM.7z.

I saw "dotnet1.exe" & "dotnet2.exe" in your first post. Try to expand them, and pack both folders together.

You'll get something smaller than the two SFXes. (and when used, you get twice less disk swapping)

Also, you can get better compression ratio using complicated command lines. Example :

7za.exe a ArchiveName.7z -r -t7z -mx=9 -ms=on -m0=BCJ2 -m1=LZMA:d24:fb273:a2:lc7:mf=bt3 -m2=LZMA:d19:fb273:a2:lc0:lp2:mf=bt3 -m3=LZMA:d19:fb273:a2:lc0:lp2:mf=bt3 -mb0:1 -mb0s1:2 -mb0s2:3 *

This one takes 2x more time to complete than the default "max" compression level, but gives smaller archive. (decompression speed is not affected)

Last but not least, 7za.exe is 3x bigger than 7z SFX module. That's only a few hundreds kilobytes, but using a SFX can make things "easier" : one big OEM.exe can auto-unpack via cmdlines.txt and add runonce entries.

The directory :

[ %CDROOT% ]
\--- [ $OEM$ ]
| OEM.exe
| cmdlines.txt

cmdlines.txt :

[Commands]
"OEM.exe"

OEM.exe root directory :

OEM\
| startx.exe
| robocopy.exe
| install.cmd
|--> dx9\
|--> dotnet1\
|--> dotnet2\
...

config.txt (for making OEM.exe SFX) RunProgram line should be :

RunProgram="startx.exe /wait /b install.cmd"

(this way install.cmd will run hidden in background)

and install.cmd should be like that (take care, i don't know it by heart) :

@echo off
rem first move directories to %systemdrive%\OEM so 7z will not find them and not delete them
rem (check the robocopy command, i'm not sure it moves the subdirs)
robocopy /MOVE *.* %systemdrive%\oem
rem now add commands for runonce :
REG ADD %KEY%\005 /VE /D "Microsoft DirectX 9c" /f
REG ADD %KEY%\005 /V 1 /D "%systemdrive%\oem\DX9\dxsetup.exe /silent" /f
REG ADD %KEY%\005 /V 2 /D "rd /s /q %systemdrive%\oem\DX9" /f

REG ADD %KEY%\010 /VE /D "Microsoft .NET Runtimes" /f
REG ADD %KEY%\010 /V 1 /D "msiexec /i %systemdrive%\oem\dotnet1\netfx.msi /qb-" /f
REG ADD %KEY%\010 /V 2 /D "rd /s /q %systemdrive%\oem\dotnet1" /f
REG ADD %KEY%\010 /V 3 /D "msiexec /i %systemdrive%\oem\dotnet2\netfx.msi /qb-" /f
REG ADD %KEY%\010 /V 4 /D "rd /s /q %systemdrive%\oem\dotnet2" /f

rem now, a defrag is really needed :rolleyes:
REG ADD %KEY%\z99 /VE /D "Defrag & reboot..." /f
REG ADD %KEY%\z99 /V 1 /D "rd /s /q %systemdrive%\oem" /f
REG ADD %KEY%\z99 /V 2 /D "defrag %systemdrive% -f" /f
REG ADD %KEY%\z99 /V 3 /D "shutdown.exe /r /t 10" /f

note that i delete each folder right after each install : very useful when installing things like sun java 1.5 or open office 2 (their install folders are huge)

you can go further : i use always the same "install.cmd" that guess wich commands must be ran (it checks if there's an msi, an innosetup, etc... add creates reg keys according to folder names), so i only need to add/remove/update folders and repack.

(and some installers can run at T-12, : no need for reg keys, only a "start /wait blablabla.exe" & "rd /s /q blabladir" ; before the robocopy command)

i hope you'll find that useful (and not too messy :whistle: )

Edited by Delprat
Link to comment
Share on other sites

I personally use a WinRAR self-extracting EXE which I call from winnt.sif with DetachedProgram to accomplish basically the same goal. Of course, I install the apps from a CD, so my $OEM$ folder mainly consists of a couple small files here and there.

Link to comment
Share on other sites

i see that indead there were even better ways than i (anticipated and true, the more files you extract (to compress with only just 1 algarithm 7z or RAR ... is even better) ...

so now i kind a wonder a bit. about how to make the 7z SFX file (as winrar seam to be able to specify a destination path, where 7z (that should in most cases be mutch better compressing) doesn't support sutch a command - that i know of....

so my Question.. do you move (or xcopy) all your oem files from %$$where-ever-temp$$%% folder to C:\OEM to get the to a more secure (against deleting) place..????

Link to comment
Share on other sites

7za.exe is great for doing what you suggested. Offtrack, but the only thing I would like to know even though cosmetic is there a way to hide the extraction window of 7za.exe while it uncompresses? Not really noticable on a fast PC or on small files.

But definately noticable on bigger files and slower cpus.

ATM I'm using nircmd to hide the 7za.exe extraction window.

Link to comment
Share on other sites

so now i kind a wonder a bit. about how to make the 7z SFX file (as winrar seam to be able to specify a destination path, where 7z (that should in most cases be mutch better compressing) doesn't support sutch a command - that i know of....

so my Question.. do you move (or xcopy) all your oem files from %$$where-ever-temp$$%% folder to C:\OEM to get the to a more secure (against deleting) place..????

There is multiple 7-Zip SFX modules (like for WinRAR) : 7z.SFX ("default" one with a gui asking where to extract) ; 7zCon.SFX (same as the previous, but in console mode : i think this one accepts switches to specify the path to extract, like 7z(a).exe) and 7zS.SFX (for making "setups" : this one accepts the "config.txt" file)

When we're talking about extracting setups, specifying a destination is of no use : the setup files should be deleted after use. But to use these files, one obviously needs to know where to find them :lol:

Here, the big OEM.exe is extracted @ T-12 (via cmdline), during GUI setup ; the setup files should remain on disk until the first GUI boot (for RunOnceEx) : the matter is not "security" against deletion... if the files are not moved/copied elsewhere, they will be deleted by 7zS.SFX (for sure !), and all those RunOnceEx entries added by install.cmd will drive you nowhere... (and may pops errors up !)

I do prefer moving instead of copying because source & destination are likely to be on the same partition (7zS.SFX extracts files to %TEMP%\7z.xxx, which is by default on %systemdrive%).

The windows MOVE command doesn't work for directory trees (you can move a folder, but not recursively), and the XCOPY command can't do a move operation.

I suggested ROBOCOPY as an alternative, but you can use any other tool.

btw, the full command should be like that :

ROBOCOPY . %systemdrive%\oem /S /E /MOVE /COPY:DSO /A-:RHS /NFL /ETA /XF ROBOCOPY.EXE STARTX.EXE INSTALL.CMD

/S /E
: like xcopy : folders & subfolders & empty ones

/MOVE
: moves files & folders instead of copying

/COPY:DSO
: include data, security attributes & owner info in the operation (not really needed)

/A-:RHS
: remove attributes read-only, hidden & system (in case of...)

/NFL /ETA
:
reduced output (no file list, only directories), with estimated time of arrival (only for cosmetic purpose -- notice that the window if you follow my "directives", but useful for debugging)

/XF ROBOCOPY.EXE STARTX.EXE INSTALL.CMD
: exclude these 3 files from moving operation

7za.exe is great for doing what you suggested. Offtrack, but the only thing I would like to know even though cosmetic is there a way to hide the extraction window of 7za.exe while it uncompresses? Not really noticable on a fast PC or on small files.

But definately noticable on bigger files and slower cpus.

ATM I'm using nircmd to hide the 7za.exe extraction window.

If you read again this thread, you'll get two answers : cmdow & startx.

If you make a SFX, you can ResHack the 7z.SFX file to modify the progress dialog (or even remove everything)

Edited by Delprat
Link to comment
Share on other sites

If you read again this thread, you'll get two answers : cmdow & startx.

If you make a SFX, you can ResHack the 7z.SFX file to modify the progress dialog (or even remove everything)

Thank You for your input on my question.

cmdow does not fully hide the 7za.exe extraction window.

startx I haven't tried.

I was sorta hoping that 7za.exe had it's own command for hiding the extraction window.

So now I know I didn't miss some little secret command...lol

But I'll stick with nircmd ftm , as it works for what I need.

Cheers

Edited by smashly
Link to comment
Share on other sites

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...