title: How to go back multiple times in a directory path?
body: <p>I am trying to create a full path for several folders. basically there is a batch script that is called, and these are the commands that will be used inside that script.
  I did this: </p>
  
  <pre><code>ECHO OFF
  SET currentDirectory=%~dp0
  echo %currentDirectory:~0,-15%
  
  SET ROOT = %currentDirectory:~0,-15%
  SET MNIST_DIR = %currentDirectory:~0,-1%
  SET DATA = %ROOT%/data/mnist
  SET BUILD= %ROOT%/Build/x64/Release
  SET BACKEND=lmdb
  </code></pre>
  
  <p>The output of <code>%~dp0</code> is <code>N:\caffe-master\examples\mnist</code><br>
  so by <code>%currentDirectory:~0,-15%</code> I meant to access <code>N:\caffe-master\</code>.
  However, It seems what I am doing is wrong, and the following command can not be executed!</p>
  
  <pre><code>"%BUILD%/convert_mnist_data.exe" %DATA%/t10k-images-idx3-ubyte %DATA%/t10k-labels-idx1-ubyte %EXAMPLES%\mnist_test_%BACKEND% --backend=%BACKEND%
  </code></pre>
  
  <p>How can I solve this problem. 
  note that I also tried CD /D to no avail as well. so this is what I came up with.</p>