title: Dos batch: How to get filename from variable that isn't an argument?
body: <p>I see lots of examples to use %nx1 to get just the filename of a file passed in with %1.</p>
  
  <p>But what if you have another variable set with a filepath and want to programmatically get the filename from that</p>
  
  <p>For example</p>
  
  <pre><code>@echo off
  SET MYPATH="c:\program files\myapp\somefile.ext"
  SET MYPATHFILE = ??
  </code></pre>
  
  <p>I am trying to get just "somefile.ext". 
  I tried replacing 1 with the var name</p>
  
  <pre><code>%nxMYPATH
  </code></pre>
  
  <p>But that doesn't work.</p>