title: In Batch: Read only the filename from a variable with path and filename
body: <p>I am currently looking for a way to take a variable in batch and only parse out the filename.</p>
  
  <p>For example, I pass my batch file a -s parameter from another application which is subsequently set to my source variable. The source file variable typically contains something like: C:\Program Files\myapp\Instance.1\Data\filetomove.ext.</p>
  
  <p>I assume to read from the end of the variable until the first "\" and set the result to a new variable filename but I have not been able to use the "for /f" commmand successfully. </p>
  
  <p>Any help would be much appreciated!</p>
  
  <p>Update: Only standard XP or Windows 2000/2003 available...(can't assume resource kits installed).</p>