title: How to enter multiple line of code in CMD from VBA?
body: <p>I want to open a cmd.exe and then execute a few lines of code.</p>
  
  <p>I searched the web for some examples.</p>
  
  <p>Code I tried modifying:</p>
  
  <pre><code>strToPrint = "Hello World!"
  Shell "cmd.exe /K echo " &amp; strToPrint, vbNormalFocus
  </code></pre>
  
  <p>I found <a href="https://stackoverflow.com/questions/34462989/how-to-write-message-to-command-window-from-vba">How to write message to command window from VBA?</a></p>
  
  <p>I tried multiple lines of coding, but the lines are executed in different command windows:</p>
  
  <pre><code>Sub CMD_VBA_Script()
      Shell "cmd.exe /K echo Hello World!", vbNormalFocus
      Shell "cmd.exe /K color 0a", vbNormalFocus
  End Sub
  </code></pre>
  
  <p>I understand when I call the Shell two times, that it will execute two times.</p>
  
  <p>My goal is to call the following script from VBA:</p>
  
  <pre><code>@echo off
      title Matrix
      color 0a
      mode 1000
  
      :a
      echo %random%%random%
      goto a
  </code></pre>
  
  <p>How can I execute multiple lines of code from VBA in command prompt?</p>