ccamel

date funktioniert aber time nicht...?

Morgän

Kleines Problem:

Ich schreibe diesen Befehl:
netsh dhcp server export c:\%date% all

und erhalte wunderbar eine Datei die mit dem Datum benannt wurde. Nun das gleiche nochmal...aber mit %time% und ich erhalte die Fehlermeldung "The Filename, directory name, or volume label syntax is incorrect."

Was geht da ab? Was mache ich falsch?

Gruss und thank god is friday
Auf Facebook teilen
Auf X (Twitter) teilen
Auf Reddit teilen
Auf Linkedin teilen

Content-ID: 125266

Url: https://administrator.de/forum/date-funktioniert-aber-time-nicht-125266.html

Ausgedruckt am: 29.04.2025 um 22:04 Uhr

lindi200000
lindi200000 18.09.2009 um 10:57:03 Uhr
Goto Top
Hi,
bei dem Befehl "time" kommen in der Ausgabe Doppelpunkte ":" vor. Die sind in eine Win Umgebung ja nicht erlaubt im Datei und Ordner Namen.

Tschüüü Lindi
ccamel
ccamel 18.09.2009 um 11:06:40 Uhr
Goto Top
Okay sehr gut leuchtet mir ein.
GermanDream
GermanDream 18.09.2009 um 11:08:55 Uhr
Goto Top
Du kannst den : aber auch entfernen

set CURRENTTIME=%TIME::=-%
set CURRENTHOUR=%CURRENTTIME:~0,2%
set CURRENTHOUR=%CURRENTHOUR: =0%
set CURRENTTIME=%CURRENTHOUR%%CURRENTTIME:~2,6%
netsh dhcp server export c:\%CURRENTTIME% all

So müsste das ganze funktinoeren face-smile
ccamel
ccamel 18.09.2009 um 11:21:44 Uhr
Goto Top
wow super hat wunderbar geklappt!

dankeschön!