Loading..
  • Lets work together

    Onsite or Remote Support

  • M-F 9:00 am - 5:00 pm

    Call (519) 573-3759

Robocopy & Rename File using Date and Time Variables

Posted ByTeam Lead

This Script copy a file to a sub folder and then rename the file using Date and Time windows variables


@echo off

robocopy N:\NewDatabase N:\NewDatabase\DBBackup LeasingDB2003-New.mdb

ren N:\NewDatabase\DBBackup\LeasingDB2003-New.mdb LeasingDB2003-New-%date:~-10,2%-%date:~-7,2%-%date:~-4,4%---%time:~0,2%-%time:~3,2%-%time:~6,2%.mdb