7zip Self Extracting Archive (SFX) without administrator privileges

ruslangil picture ruslangil · Jul 29, 2013 · Viewed 14.2k times · Source

I use 7zip to create the SFX as follows:

7z.exe a -r archive.7z *

Then I do a binary copy with the 7zS.sfx file (used to create a self extracting installer), config file "build.config", and the archive. The contents of config file are as follows:

;!@Install@!UTF-8!
RunProgram="setup.exe"
GUIMode="1"
Path="%tmp%\\mytemp"
;!@InstallEnd@!

Binary copy command is as follows:

copy /b 7zS.sfx + build.config + archive.7z sfxInstaller.exe

Problem is that the result SFX "sfxInstaller.exe" requires admin privileges for executing. Is it possible to generate Self Extracting Archives using 7-Zip that do not require admin privileges? If so, what parameters/command line arguments should I use? Thanks in advance.

Answer

alexsakhnov picture alexsakhnov · Jan 16, 2019

I fixed this problem with mpursuit answer.

To update manifest of 7zS.sfx you can use the following procedure:

manifest.xml

   <?xml version="1.0" encoding="utf-8"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">

      <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
        <application>
          <!--application support for Windows Vista -->
          <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
          <!--application support for Windows 7 -->
          <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
        </application>
      </compatibility>

      <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
        <security>
          <requestedPrivileges>
            <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
          </requestedPrivileges>
        </security>
      </trustInfo>

    </assembly>
call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86
mt.exe -manifest manifest.xml -outputresource:"7zS.sfx;#1"
copy /b 7zS.sfx + build.config + archive.7z sfx_archive.exe