According to the -sfx (Create SFX archive) switch and Command Line Version User's Guide:
SFX_Module - Specifies the SFX module that will be combined with the
archive. This module must be placed in the same directory as the
7z.exe. If SFX_Module is not assigned, 7-Zip will use standard
console SFX module 7zCon.sfx.
The whole process of creating installer is well documented, including an example of the config file and batch file you need to use to pack the installer. It's what you already did and posted here.
There is also a description of which module you need for the particular use-case:
SFX_Module Description
- 7z.sfx SFX module (GUI version)
- 7zCon.sfx SFX module (Console version)
- 7zSD.sfx SFX module for installers (GUI version)
- 7zS2.sfx small SFX module for installers (GUI version)
- 7zS2con.sfx small SFX module for installers (Console version)
The file that can be used to pack an installer / .exe project is 7zSD.sfx or 7zS.sfx.
They are both made for installers. Use it if you want to create a self-extracting archive that performs the installation, extracts archive to the temporary folder during the installation, runs the specified program and cleans the temporary files up after the installation is done.
The difference between them is:
7zSD.sfx uses MSVCRT.dll, which is the C standard library for the Visual C++ (MSVC) compiler from version 4.2 to 6.0. Your self-extracting archive won't run on pure, old Windows if some other application didn’t install MSVCRT.dll on that machine. It is included with every modern Windows installation, on top of which most Windows applications are built.
Since you should be safe now days about MSVCRT.dll, using both 7zS.sfx and / or 7zSD.sfx is ok, just pick one and things should work smoothly.
There is no need to download via SourceForge anymore. In current versions of 7-Zip, the required .sfx file is not part of 7z-Extra download, it is part of the LZMA SDK.
https://www.7-zip.org/sdk.html
You need to extract LZMA SDK and copy 7zS.sfx and / or 7zSD.sfx next to the 7z.exe.