title: Difference between %variable% and !variable! in batch file
body: <p>I am writing a batch file where I need to output a string containing '!' to another file. But when I echo that string to another file, it removes "!" from the output. </p>
  
  <p>Eg:
   Input:</p>
  
  <pre><code>set LINE=Hi this is! output
  echo !LINE!&gt;&gt;new_file.txt
  </code></pre>
  
  <p>Output in new_file.txt is:</p>
  
  <pre><code>Hi this is output
  </code></pre>
  
  <p>Also, if input is</p>
  
  <pre><code>set LINE=Hello!! this is output!!
  echo !LINE!&gt;&gt;new_file.txt
  </code></pre>
  
  <p>Output in new_file.txt:</p>
  
  <pre><code>Hello
  </code></pre>
  
  <p>Hence, it skips the ! (Exclamation mark) from the output to the new_file.
  If I use %LINE%, then it simply displays "echo is on" to the output file.</p>
  
  <p>Please suggest a way to overcome this problem.</p>