title: Windows batch script containing binary executable
body: <p>I want to create a windows <code>batch</code> script, which will have a <code>base64</code> encoded program included. By included I mean - the encoded program will be "hardcoded" - there should be a "function" (or a code block) which will write the file line by line.</p>
  
  <p>(like in this question related to Linux <code>Bash</code>: <a href="https://stackoverflow.com/questions/18410785/bash-script-containing-binary-executable">Bash script containing binary executable</a>)</p>
  
  <p>I want to ask you what is the best method to do something like this, when it should apply to the following points:</p>
  
  <ul>
  <li>I want to use only the tools bundled with Windows (no additional libraries, executables etc)</li>
  <li>The file should be single - It can simply include the <code>base64</code> encoded string in any way</li>
  <li>I want t get the highet spossible performance</li>
  </ul>
  
  <p>I've tried to convert each <code>base64</code> encoded line to an echo call, but this is very slow. Echoing 6000 lines takes about 10 seconds (I want to generate a file whcih will have about 10 000 lines with this method).</p>
  
  <p>Is there a better method to do this? Maybe there is a "file splitter" in windows, which will allow me to split this batch script and "extract" somehow some lines (like extract lines 100-10100) and save them to another file?</p>
  
  <p>A part of currently used file generation is as follows:</p>
  
  <pre><code>:getbin_Windows_x86
  [...]
  echo f0VMRgIBAQAAAAAAAAAAAAIAPgABAAAAsCVAAAAAAABAAAAAAAAAAEiGBQAAAAAAAAAAAEAAOAAK&gt;&gt;%INSTALLER_BASE_TMP%
  echo AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA&gt;&gt;%INSTALLER_BASE_TMP%
  echo AAAMAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA&gt;&gt;%INSTALLER_BASE_TMP%
  [...]
  GOTO:EOF
  </code></pre>
  
  <p>I would love to do it using batch files, but if <code>Power Shell</code> will give me some better result, I'll move over it.</p>