WCM Forum

WCM Forum (http://www.wcm.at/forum/index.php)
-   Programmierung (http://www.wcm.at/forum/forumdisplay.php?f=17)
-   -   Datum in cmd für Logfile (http://www.wcm.at/forum/showthread.php?t=239654)

J@ck 15.07.2010 16:45

Datum in cmd für Logfile
 
Frage zur Erstellung von Logfiles mittels cmd:

Hab einen Robocopy Befehl, mit der Endung
Code:

robocopy....... /LOG:"E:\Data\sync_log.log" /NP
Jetzt hätte ich gerne, dass mir für jeden Tag ein neues Log File erstellt wird und nicht überschrieben wird (also irgendwo am Anfang des Namens [DATUM]sync_log.log oder so.

Mit dem Befehl date /t bekomme ich das Datum im Format dd.mm.yyyy - schöner wäre yyyymmdd.

Wie kann ich das im .cmd realisieren?

Danke & LG!

Jack

Don Manuel 15.07.2010 16:57

Nimm das als Grundlage und modifiziere nach Bedarf.

J@ck 16.07.2010 08:39

Danke

arctic 16.07.2010 09:05

Hi,

ich verwende namedate.exe für sowas

J@ck 16.07.2010 13:02

Danke euch, hab es aber mittlerweile so gelöst:

Code:

@For /F "tokens=1,2,3 delims=. " %%A in ('Date /t') do @(
Set Day=%%A
Set Month=%%B
Set Year=%%C
Set yyyymmdd=%%C%%B%%A
)

Fertiger Befehl:
Code:

robocopy ....... /LOG:E:\Data\sync_%yyyymmdd%.log /NP


Alle Zeitangaben in WEZ +2. Es ist jetzt 18:46 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© 2009 FSL Verlag