Though this can be applied in many ways, the WindowsNT/2000 Command Prompt has some powerful differences over the old MS-DOS Batch Language. the FOR command is just one difference. The delimiters specified and the order of the variables (%a, %b, %c) will depend on your localized settings. By default the following should create a folder called '20031129' (based on November 29th, 2003).
FOR /F "tokens=2,3,4 delims=/ " %a in ('date /t') do mkdir %c%a%b
This could be applied to a daily backup procedure using PKZIP from a command-line.
2 comments:
I found a better way:
MKDIR %DATE:~6,4%%DATE:~3,2%%DATE:~0,2%
Though the same concerns are raised, the splicing is completely dependant on your localisation.
Excellent! This solved my problem on the spot. Thanks.
Post a Comment