title: Weird behavior of windows CMD when running groovy
body: <p>I have a groovy script that renames files that match a regex
  I launch it this way </p>
  
  <pre><code>C:\&gt;groovy rename test.* test.txt
  </code></pre>
  
  <p>It works fine.</p>
  
  <p>But when I try to pass this regex:</p>
  
  <pre><code>C:\&gt;groovy rename test\.(.*) $1_TEST_$1
  </code></pre>
  
  <p>the command line returns a message:</p>
  
  <p><code>The syntax of the command is incorrect</code></p>
  
  <p>and it's not my script - its  <code>cmd</code> that writes this. My script never even runs. It also happens even when I wrap the arguments (regex) in quotes.</p>
  
  <p><strong>Q:</strong> Why? How can I pass any regex as param?</p>
  
  <p><hr/>
  Since nobody can figure out what's going on, I've made an even simpler example:</p>
  
  <p><strong>test.groovy</strong></p>
  
  <pre><code>println args[0]
  </code></pre>
  
  <p>I run it: <code>groovy test Bob</code> and the output is, not suprisingly, <code>Bob</code>.
  But when I run e.g. <code>groovy test .*</code> I get <code>The syntax of the command is incorrect</code>. When I run it <code>groovy test *</code> then a name of a pdf file comes out (that happens to be in the same dir as <code>test.groovy</code>)</p>