On Fri, Dec 23, 2022 at 2:42 AM M. Osman Talayman <[email protected]>
wrote:

> 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
>

If you're willing to use 4DOS it's:

echo %_year%%_month%%_day

4DOS uses little memory and does a lot.  You can get 4DOS at
https://4dos.info/sources.htm

Also Hello all this is my first post
redwdc
_______________________________________________
Freedos-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freedos-user

Reply via email to