title: Rename a text file adding current date
body: <p>I've been looking over some examples and think I am close.  I need something to rename a file that my Barr server saves to the Archive folder with the current date.  The file is named &quot;E!!Admin#0001.txt&quot;.  i.e. to rename: CRCCPC_08-30-2022.txt , then move that file to a different location.  The location is &quot;D:\File Upload\CRCCPC&quot;.</p>
  <pre><code>echo on
  for /f &quot;skip=1&quot; %%x in ('wmic os get localdatetime') do if not defined MyDate set MyDate=%%x
  set today=%MyDate:~0,4%-%MyDate:~4,2%-%MyDate:~6,2%
  
  
  set &quot;_year=%MyDate:~0,4%&quot;
  set &quot;_month=%MyDate:~4,2%&quot;
  set &quot;_day=%MyDate:~6,2%&quot;
  
  REN D:\Barr\Archive\&quot;E!!Admin#*.txt&quot; &quot;CRCCPC_&quot;(%_year%%_month%%_day%)&quot;_01.txt&quot;
  MOVE CRCCPC* D:\File Upload\CRCCPC
  
  pause
  </code></pre>
  <p>I'm getting wmic not recognized as an internal or external command.  The rename and copy are getting a invalid syntax.</p>