How to create an autobackup batch script
In dayly DOS experiments with retro hardware it is useful to have a script to automatically back up your autoexec.bat and config.sys files. While internet is full of different batch files and samples, but only few of them work in older DOS, namely 6.22.
Here's a script that automatically backs up autoexec.bat and config.sys:
;This autobackup script backs up autoexec.bat and config.sys every day. ;Created by Racoonrider for www.vogonswiki.com @ECHO OFF VER|DATE>TEMP.BAT ECHO SET DATE=%%4>CURRENT.BAT CALL TEMP.BAT DEL TEMP.BAT DEL CURRENT.BAT md C:\AUTOBACK\ lmd C:\AUTOBACK\%DATE% lcopy C:\AUTOEXEC.BAT C:\AUTOBACK\%DATE%\AUTOEXEC.BAT /y lcopy C:\CONFIG.SYS C:\AUTOBACK\%DATE%\CONFIG.SYS /y ECHO Backup created on %DATE%.
The first six lines of this script capture system date. Than a directory with a name formatted
dd-mm-yyyy is created in C:\AUTOBACK\. Your autoexec.bat and config.sys files are copied in that directory. LFN Tools extension is used to handle long directory name containing system date.
With this script added to your autoexec.bat (via
CALL function or by copying the lines directly), your autoexec.bat and config.sys will be backed up every time you turn on your PC. However, the files in the same
dd-mm-yyyy directory are overwritten.