title: updating command line parameters in batch file
body: <p>**Batch file **I am writing batch file that takes in command line parameters and do some stuff if the parameters match. But when the run the batch file again with the new parameters, the file still runs with the old parameters.</p>
  
  <ol>
  <li><p>first run : file.bat -name hello -w 400 -r 320</p></li>
  <li><p>second run : file.bat -name hello -w 400.</p></li>
  </ol>
  
  <p>When i do the second run of the file, it still performs the first run, i mean to say it still considers the parameters from the first run. Does anybody know why this is the case?</p>
  
  <p>Thanks in advance.</p>
  
  <p>Sorry for not posting the batch file code.
  below mentioned is the code.</p>
  
  <pre><code>set filename= 
  set rate=
  set hidden=
  set rate=
  :recheck 
  if  "%1"=="-help"  goto :help
  if  "%1"=="-name"  goto :filename
  if  "%1"=="-h"     goto :hidden 
  if  "%1"=="-w"     goto :weight 
  if  "%1"=="-r"     goto :rate 
  if  "%~1"==""      goto :endofcommandline
  :filename 
  shift 
  set filename =%1
  shift   
  goto :recheck
  </code></pre>
  
  <p>For the other part of the file, I use the variable "filename" to do other stuff. I also use setlocal and endlocal at the beginning and the end of the file.
  I have other corresponding labels for the each if statement and set different variables to the values passed to them if any by the user. 
  Sometimes, I also get echo is off when I try to print out the value of some variable.
  All the variables which I use are cleared in the beginning of the file as mentioned above.</p>