Batch File Problem

Viewing 1 post (of 1 total)
  • Author
  • Avatar

    Since I started in IT when DOS was considered an advanced technology I am almost embarrassed to have to ask for help with this, but since I have little hair left I guess I will swallow my pride and put this out there.

    Without going into my normal painful detail; from a 2008 R2 server I need to automatically rename a directory on a mapped drive (Z: ) while adding the date to that folder and then create a new empty one with the same name as the original one I renamed. I am backing up folders from the server to the qb_copy folder.

    Here is what I have done so far but it fails at the rename function. I cannot figure out why. The variables work, the wait time works and the new directory creation works. Just the rename fails with a syntax error. When the batch file is finished I should have a populated folder named QB_Copy_For_07-20-2014 (as of today’s date)

    for /f “tokens=2-4 delims=/ ” %%a in (‘DATE/T’) do set cdate=%%a-%%b-%%c

    set “var1=QB_Copy_For_”

    ren z:qb_copy z:%var1%%cdate%

    ping -n 1 -w 6000>NUL

    MD z:”qb_copy

    What am I doing wrong?


Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.