Tuesday, November 6, 2007

I have a daily job to create a backup from a file. But each backup must have a different name.
What i did is create a schedule job on my XP machine with .BAT file that runs every day.

The hard thing in Dos is giving a name that is unique.

Here are the doscommands:

@echo off
for /F "tokens=2-4 delims=/ " %%i in ('date /t') do set yyyymmdd=%%k%%i%%j
echo Date: %yyyymmdd%
for /F "tokens=1-2 delims=: " %%l in ('time /t') do set hhmm=%%l%%m
echo Time: %hhmm%
rem -- or use both
echo %yyyymmdd%%hhmm%
rem -- here is the copy command with just the date appended

REN E:\Sx3\FTP\pl.txt pl%yyyymmdd%%hhmm%.txt
REN E:\Sx3\FTP\llpg.txt llpg%yyyymmdd%%hhmm%.txt


overview parameters you find here

No comments: