Wednesday 21 October 2009

CMD: Current date/time for file suffix (and others)

The following lines give me the current date + time as string that I use as extension for file/directory names

@SET LDATETIME=%DATE%_%TIME%
@SET LDATETIME=%LDATETIME::=-%
@SET LDATETIME=%LDATETIME:,=-%
@SET LDATETIME=%LDATETIME:.=-%
@echo LDATETIME=%LDATETIME%

The output will look like this

LDATETIME=21-10-2009_12-37-35-83

Maybe these are the lines you have been longing for.....

Cheers,
Jürgen

No comments: