m3tatai
Goto Top

Datumsformat in VBS ändern und in .cmd-Datei schreiben

Hallo zusammen,

ich suche nach einer Möglichkeit mit Hilfe eines VB-Scriptes ein Textdokument zu erstellen und mit Inhalt zu füllen.
Das klappt fast ohne Probleme.

Dim fso, MyFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile("testfile.cmd", True)
MyFile.WriteLine("merge= no")
MyFile.WriteLine("grain = 0")
MyFile.WriteLine("file= c:\Tempdaten\Westring2 .txt")
MyFile.WriteLine( start = AktuellesDatumImFormatWieUnten )
MyFile.WriteLine("end = 31-12-2100")
MyFile.Close

Wie ihr seht, möchte ich, dass das aktuelle Datum im Format DD-MM-YYYY automatisch eingefügt wird , was mir bisher aber nicht gelungen ist.
Habt ihr ne Idee? Bin in Sachen Programmierung nicht so bewandert, ich bitte um Nachsicht .


Vielen Dank schonmal im voraus für eure Hilfe.


MfG


m3tatai

Content-Key: 141421

Url: https://administrator.de/contentid/141421

Printed on: April 27, 2024 at 01:04 o'clock

Mitglied: 76109
76109 Apr 26, 2010 at 07:04:55 (UTC)
Goto Top
Hallo m3tatai!

In etwa so:
Datum = Right("0" & Day(Date), 2) & "-" & Right("0" & Month(Date), 2) & "-" & Year(Date)  
.....
MyFile.WriteLine("end = " & Datum)  
wobei die Variable Datum das aktuelle Datum im Format DD-MM-YYYY enthält

Gruß Dieter
Member: m3tatai
m3tatai Apr 26, 2010 at 07:12:00 (UTC)
Goto Top
Klappte direkt ! face-smile
Danke für deine fixxe Antwort !