title: How do I specify a relative local file path in DOS?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2953027/how-do-i-dynamically-specify-a-file-in-dos">How do I dynamically specify a file in DOS?</a>  </p>
  </blockquote>
  
  
  
  <p>I am using c#.NET 2.0 to execute DOS commands to ftp a file. All works except for 1 thing, in the cmd file I call, it runs a PUT statement. Right now the put statement has a hardcoded local file path. I need to specify a dynamic path. I've tried </p>
  
  <pre><code>put %~dp0\myfile.DTL myfile.dtl
  </code></pre>
  
  <p>but it says it can't find the file.</p>
  
  <p>Right now the .NET code calls a BAT file which only exist to call the CMD file. Interestingly, the BAT file DOES successfully use a relative path in its call to the CMD file: </p>
  
  <pre><code>ftp.exe -s:%~dp0\oit.cmd 
  </code></pre>
  
  <p>However, I can't get that relative path to wrok in the cmd file:</p>
  
  <pre><code>open &lt;my host&gt; 
  &lt;user name&gt; 
  &lt;password&gt; 
  put &lt;hardcoded path that needs to be relative path&gt;localfilename remotefilename
  </code></pre>
  
  <p>I'll bever know where it will exist so I just need to grab whatever local directorey the file is in.</p>