title: SHIFT doesn’t affect %*
body: <p>I’m trying to add some optional paramters to a batch file but am having trouble because the <code>SHIFT</code> command does not affect the <em>all-arguments</em> variable <code>%*</code>.</p>
  
  <p>Does anyone know how I can allow for optional batch-file arguments if I have to use <code>%*</code>?</p>
  
  <p>For example, a simple example that merely prints the arguments to the screen with and without a new-line, using an optional argument to determine which:</p>
  
  <pre><code>@echo off
  if (%1)==()   goto usage
  if (%1)==(/n) goto noeol
  goto eol
  
  :eol
    echo %*
    goto :eof
  
  :noeol
    shift
    call showline %*
    goto :eof
  
  :usage
    echo Prints text to the screen
    echo &gt; %0 [/n] TEXT
    echo /n to NOT print a new-line at the end of the text
    goto :eof
  </code></pre>