Consultor Eletrônico



Kbase P129072: How to store backups in a directory named based on date on a Windows system?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   08/07/2008
Status: Unverified

GOAL:

How to store backups in a directory named based on date on a Windows system?

GOAL:

How to determine the current date on Windows via a script?


FACT(s) (Environment):

Windows
OpenEdge 10.x
Progress 9.x

FIX:

The following example shows a script that will determine the current date and save it in a variable for later use:

echo on
@REM quick date batch (MMDDYYYY format)
@REM Setups %date variable
@REM First parses month, day, and year into mm , dd, yyyy formats and then combines to be MMDDYYYY

FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET CDATE=%%B
FOR /F "TOKENS=1,2 eol=/ DELIMS=/ " %%A IN ('DATE/T') DO SET mm=%%B
FOR /F "TOKENS=1,2 DELIMS=/ eol=/" %%A IN ('echo %CDATE%') DO SET dd=%%B
FOR /F "TOKENS=2,3 DELIMS=/ " %%A IN ('echo %CDATE%') DO SET yyyy=%%B
SET date=%mm%%dd%%yyyy%