title: How can I write a null ASCII character (nul) to a file with a Windows batch script?
body: <p>I'm attempting to write an ASCII null character (nul) to a file from a Windows batch script without success. I initially tried using <code>echo</code> like this:</p>
  
  <pre><code>echo &lt;Alt+2+5+6&gt;
  </code></pre>
  
  <p>which seems like it should work (typing <code>&lt;Alt+2+5+6&gt;</code> in the command window does write a null character - or <code>^@</code> as it appears), but <code>echo</code> then outputs:</p>
  
  <pre><code>More?
  </code></pre>
  
  <p>and hangs until I press <code>&lt;Return&gt;</code>. As an alternative I tried using:</p>
  
  <pre><code>copy con tmp.txt &gt;nul
  &lt;Alt+2+5+6&gt;&lt;Ctrl+Z&gt;
  </code></pre>
  
  <p>which does exactly what I need, but only if I type it manually in the command window. If I run it from a batch file it hangs until I press <code>&lt;Ctrl+Z&gt;</code> but even then the output file is created but remains empty.</p>
  
  <p>I really want the batch file to stand alone without requiring (for example) a separate file containing a null character which can be copied when needed.</p>