Thank you all for your suggestions.

I will definitely look into 4dos. I will not use its specific date and
time functions as that will tie me to it. However, it is interesting
in itself. Is it used a lot amongst FreeDos users?
I guess I was too focused on doing everything from a batch file. I
should, of course, have look into doing it using some of the other
tools suggested like AWD, SED etc.
The suggestion for using struct dosdate_t dt; and struct dostime_t tm;
as suggested by Jim Hall, works perfectly and it allows me to format
the date and time any way I want. Also it is simple.
The amount of data that will go into my log files is minimal. It is
just for me to keep track of what happens when I run certain batch
jobs that I will write eventually (I'm just getting started with
FreeDos).

Thanks a lot and have a merry christmas
/Osman


Den fre. 23. dec. 2022 kl. 08.41 skrev M. Osman Talayman <talay...@gmail.com>:
>
> Hello,
>
> I just can't figure this one out: From a .bat file, I want to write
> entries to a log file. Each entry should have a date and time in the
> form YYYYMMDD:HHMMSS I have searched the internet for solutions on how
> to do this, but none of the solutions work (I think they are for
> cmd.exe in modern Windows which is more advanced than command.com).
>
> My first problem is, that I just cannot figure out how to write just
> the date without all the preceeding text (Current date is Thu
> 12-23-2022). I tried some a substring routine like  this, which I
> found on a web page
>
> set YYYYMMDD=%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%
> echo %YYYYMMDD%
>
> I changed the numbers to reflect my date output
>
> I ran the .bat file, but all it says i "ECHO is on", so first problem
> is: How do I write a date to a file from a .bat file?
>
> Second problem is, that I want to alway have the date formatted as
> YYYYMMDD no matter which locale it is run on. Is there any call that
> can be made in FreeDOS to automatically format the date in a specifc
> way no matter which locale is used?
>
> Thanks and marry christmas
> /Osman


_______________________________________________
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user

Reply via email to