Browse
 
Tools
Categories

How to make .bat (Batch File) that will backup OneSource AND append date and time to end of file.

Author: Steve Childs Reference Number: AA-01721 Created: 2011-07-26 19:23 Last Updated: 2011-07-26 19:28 0 Rating/ Voters

Rem @echo off
@For /F "tokens=1,2,3,4 delims=/ " %%A in ('Date /t') do @(

Set DayW=%%A
Set Day=%%B
Set Month=%%C
Set Year=%%D
Set All=%%A-%%B-%%C%%D
)

@For /F "tokens=1,2,3 delims=:,. " %%A in ('echo %time%') do @(
Set Hour=%%A

Set Min=%%B
Set Sec=%%C

Set Allmin=%%A.%%B.%%C
)

copy "X:\PathX\CompanyDataFile.mdb" "Y:\CompanyDataFile_%All%_%AllMin%.mdb"


NOTE:

X=Name of Drive letter
PathX=Path to folder where company data file resides
Y=Drive letter (or preferrably removed drive letter)