title: How to create Windows compatible rar sfx archive on Linux
body: <p>I want to create a <code>rar</code> SFX archive that can be executed on Windows, using Linux. Suppose I want to put in the archive the file <code>myprog.exe</code> and automatically execute the file when the archive is extracted.
  I've created a init script (<code>myinit.txt</code>)</p>
  
  <pre><code>;The comment below contains SFX script commands
  Path=%TEMP%
  Setup=tftpd32.exe
  TempMode
  Silent=1
  Overwrite=1
  </code></pre>
  
  <p>Then I created the archive with the following commands:</p>
  
  <pre><code>rar a -sfx archive.exe myprog.exe
  rar c archive.exe &lt; myinit.txt
  </code></pre>
  
  <p>Now if I open archive.exe with Winrar I can see my file and all the Option I set correctly. The problem is that if I try to execute the file (with double click) I get an error:</p>
  
  <blockquote>
    <p>program too bit to fit in memory</p>
  </blockquote>
  
  <p>I suppose the problem is that the file doesn't have the layout of a Windows executable.</p>
  
  <p>Searching around I found that <code>zip</code> has an option <code>-A</code> that can be used to fix this problem. Is there a way to to that with <code>rar</code>?</p>