title: Converting .bat to .exe with no additional external software (Create SFX)
body: <p>Following the same steps as this <a href="https://www.howtogeek.com/50364/convert-a-batch-bat-script-to-an-executable-exe-file/" rel="noreferrer">guide</a>. I am trying to convert from bat to exe without installing any new software such as <a href="http://www.f2ko.de/en/b2e.php" rel="noreferrer">Bat to Exe Converter</a>. The reason I am using this method is because all machines in my workplace already have 7zip installed and can use it, however I am not allowed to make the script work using external software not present on the main server to be compatible on any machine in the company.</p>
  
  <p>I have the following <strong>TEST.bat</strong>:</p>
  
  <pre><code>ECHO This is a Test bat to exe
  pause
  </code></pre>
  
  <p>and the <strong>config.txt</strong>:</p>
  
  <pre><code>;!@Install@!UTF-8! 
  RunProgram="TEST.bat" 
  ;!@InstallEnd@! 
  </code></pre>
  
  <p>then I call the following command line (in another .bat):</p>
  
  <pre><code>COPY /B "%PathTo7Zip%\7zCon.sfx" + %Config% + %Source7ZFile% %OutputFile%
  </code></pre>
  
  <p><code>%PathTo7Zip%</code> is the directory to <strong>7zCon.sfx</strong>
  <code>%Config%</code> is the <strong>config.txt</strong> file above
  <code>%Source7ZFile%</code> is my .7z archive
  and <code>%OutputFile%</code> is my output <strong>TEST.exe</strong> file which should supposedly run the bat file when I call it according to the author of the guide.
  However calling <code>TEST.exe</code> triggers unzipping the .7z archive (which is expected) and then exits without running <strong>TEST.bat</strong>.</p>
  
  <p>However the author explains:</p>
  
  <p><em>Conclusion:</em></p>
  
  <p><em>It is important to note that while the resulting file runs exactly the same as the source BAT file, this is not a true batch to executable conversion. The resulting file is an EXE, however it is intended to be used for self-extracting installers. When you execute the resulting EXE file, the process goes something like this:</em></p>
  
  <ol>
  <li><em>The contents of the EXE file are extracted to the temp directory.</em></li>
  <li><em>The config file generated by the script is read.</em></li>
  <li><em>The batch file contained in the EXE file is executed in a new
  command window.</em></li>
  <li><em>Once finished, the temp files are removed.</em></li>
  </ol>