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

7zip archive installers with reg file for the app

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
9 replies to this topic

#1
matthewk

matthewk

    Member

  • Member
  • PipPip
  • 297 posts
  • Joined 07-June 05

21.
The direct-copy to new install method

In some cases, you see programs which use non-standard or un-automatable installers.
In such cases, just install it first, and clean out the junk (like uninstaller) from the installed folder. Then configure the app's settings to how you want.
Then, just make a winrar SFX archive of that folder (which silently extracts to %programfiles%) and enjoy.
For example, I do the above, by enabling the "SFX" check-box, and pasting the below into the "Comments" tab in winrar

;The comment below contains SFX script commands

Path=.\%programfiles%
SavePath
Silent=1
Overwrite=2
Then put shortcuts to the app at:
$OEM$\$Docs\All Users\Start Menu\Programs\YOURAPPFOLDER

<{POST_SNAPBACK}>

Is there a way to do a 7zip exe and have a registry file that executes after the contents have extracted? I've read of sfx archives and such, but I've never found a guide on this. Thanks so much!


How to remove advertisement from MSFN

#2
Sodium Cyanide

Sodium Cyanide

    Now I Am Become Death, Destroyer of Worlds

  • Member
  • 23 posts
  • Joined 23-September 05
Check out this guide for help.

Here's what I would do. You will need to do a few things:

1. Create a file in UTF-8 format named config.txt, do not include in archive
2. Get the 7zS.sfx file from the topic posted above, do not include in archive
3. Create a batch file, temp.bat, and add it to the stuff you are going to archive
4. Get your .reg file, put it in with the stuff you are going to archive

config.txt should look like this:
;!@Install@!UTF-8!
RunProgram="temp.bat"
;!@InstallEnd@!
Be sure to save it as a .txt file with UTF-8 encoding, not ANSI.

temp.bat should look like this:
setup.exe /switch
/wait REGEDIT /S temp.reg
Obviously change setup.exe to the name of your setup program in the archive, and change /switch to whatever parameters you need to do a silent install. Also, temp.reg should correspond with the name of your .reg file.

So when you are done creating temp.bat and have added both it and your .reg file to the files you plan to archive, you can then begin compressing them with 7zip. The output will be a .7z file. We'll call it setup.7z. Take this file, setup.7z, and put it in a directory with 7zS.sfx and config.txt.

Launch a cmd window from this directory and use the following commands:
copy /b setup.7z + 7zS.sfx + config.txt setup.exe
This will merge the three input files into one self-extracting .exe, which will launch the batch file we created after extracting the contents of the archive. If you want to make the self-extracting .exe to be silent while it is decompressing the archive, you will have to follow the instructions in the topic I posted above to hack the 7zS.sfx file with reshack.

If you need further clarification, I will do my best to help.
Do you think anyone really cares what's in your computer?

#3
matthewk

matthewk

    Member

  • Member
  • PipPip
  • 297 posts
  • Joined 07-June 05
Thank you so much. Very clear, excellent explanation. Thanks for the link too; I had not seen that one.

#4
matthewk

matthewk

    Member

  • Member
  • PipPip
  • 297 posts
  • Joined 07-June 05
I have some files that need to be placed in system32. I also have the files that I want to place in programfiles. I can build the exe, but I think I am building it incorrectly as it does not work. I thought as a workaround to only use one 7z as the guide shows would be to place the system32 files into the winamp folder and then move them after the extraction has taken place. What am I doing wrong?
tmp.bat contents:
7za.exe x -y -aoa winamp.7z -o"%PROGRAMFILES%"
7za.exe x -y -aoa sys32.7z -o"%SYSTEMROOT%\system32"
move %PROGRAMFILES%\winamp.lnk %ALLUSERSPROFILE%\Desktop
copy %ALLUSERSPROFILE%\Desktop\winamp.lnk "%APPDATA%\Microsoft\Internet Explorer\Quick Launch"
/wait REGEDIT /S tmp.reg
config.txt has same relative contents as shown in the guide. I found the 7za.exe example in later pages on the thread you posted a link to; normally to allow this, I should install 7zip first or should I just place the 7za.exe in system32 folder?
Posted Image
copy /b winamp.7z + sys32.7z + 7zS.sfx + config.txt winamp.exe

#5
matthewk

matthewk

    Member

  • Member
  • PipPip
  • 297 posts
  • Joined 07-June 05
I ran my tmp.bat for testing, and it worked fine. It would be nice to have this all into 1 file executable though via 7zip. In this case of testing my tmp.bat, I do have a copy of 7za.exe in the system32 folder, and I have 7zip installed (having 7zip installed or not is something I am curious of as well). It has to be something simple I am missing. I know how to do this type thing with rar sfx archives. Thanks in advance to those willing to share knowledge on this! :)

#6
Sodium Cyanide

Sodium Cyanide

    Now I Am Become Death, Destroyer of Worlds

  • Member
  • 23 posts
  • Joined 23-September 05
Hey there

I'm not overly experienced making self-extracting 7zip archives when compared to some others on the forums, but I will do my best to help you out. One thing I can tell you right now is that 7za.exe is a standalone console program, there is no need to have 7zip installed to use it.

Putting 7za.exe into system32 seems to be a wise idea. I might have to use that on my future install discs. :)

Anyway, since you say the batch file works, then the solution is within very close reach. If you try making a single .7z archive, then maybe you could make two folders within that archive, for example Winamp and Sys32. Just drop all your files in there, uncompressed (they will get compressed when they become a .7z archive). Then, try the following commands in the batch file to extract the contents (and do the rest of your tasks):

tmp.bat
copy /y .\Winamp\*.* "%PROGRAMFILES%\Winamp"
copy /y .\Sys32\*.* "%SYSTEMROOT%\system32"
move "%PROGRAMFILES%\Winamp\winamp.lnk" "%ALLUSERSPROFILE%\Desktop"
copy "%ALLUSERSPROFILE%\Desktop\winamp.lnk" "%APPDATA%\Microsoft\Internet Explorer\Quick Launch"
/wait REGEDIT /S tmp.reg
Give that a try. I think that is what you are trying to do, right? Lol I'm a little tired (2 midterm exams tomorrow, and a couple school projects due this week). Anyway, like I said I don't have a whole lot of experience with this stuff but hopefully that will work. It might not even be close. We'll cross our fingers. ;)
Do you think anyone really cares what's in your computer?

#7
matthewk

matthewk

    Member

  • Member
  • PipPip
  • 297 posts
  • Joined 07-June 05
Thanks for your reply. Good luck with your tests! I've got a big one tomorrow. This works if these particular folders don't have subfolders. If winamp for example has a subfolder, the copy /y *.* doesn't get the subfolder and its contents.

#8
nakira

nakira

    Member

  • Member
  • PipPip
  • 118 posts
  • Joined 18-July 04
Try xcopy (xcopy /? in cmd window for syntax)

#9
matthewk

matthewk

    Member

  • Member
  • PipPip
  • 297 posts
  • Joined 07-June 05

Try xcopy (xcopy /? in cmd window for syntax)

Wow, it seems there would be a more efficient way of doing this. I thought two 7z files could be used or something. Anyone? :whistle:

#10
matthewk

matthewk

    Member

  • Member
  • PipPip
  • 297 posts
  • Joined 07-June 05
Is everyone here clueless as I am on this? It would be great if someone doesn't mind helping me