title: How can we use the current directory path(%~dp0) with 'ren' command in a batch file?
body: <p>I want to rename a file which is present in the sub directory and the known part of the file name is '<strong>.log</strong>'.
  When I try something like below</p>
  
  <p><strong><code>ren  subdirectory\*.log*  file2.txt</code></strong></p>
  
  <p>or </p>
  
  <p><strong><code>ren  .\subdirectory\*.log*  file2.txt</code></strong></p>
  
  <p>I get error : <strong><code>The syntax of the command is incorrect.</code></strong>
  I have two questions here:</p>
  
  <ol>
  <li><p>Do I always need to give full path in <a href="https://technet.microsoft.com/en-us/library/bb490987.aspx" rel="nofollow">ren</a> command for file1?</p></li>
  <li><p>If yes, then how can I we give the full path if I do not want to hard code it?</p></li>
  </ol>
  
  <p>I got to know that we can use '<strong>%~dp0</strong>' to get the current directory path but I am not sure how to use it with 'ren'. </p>