Detecting time in BAT file under DosBox using IF

General information and assistance with DOSBox.

Detecting time in BAT file under DosBox using IF

Postby BulmaSoft » 2018-4-15 @ 17:41

Hello everyone.

I hope I'm writing in the correct segment of the forum.

What I would like to do is something like this:
(in a BAT file, running under DosBox)

If Time==(certain time, example 19:37) then (do something)

DosBox have the Time and Time /T command.
But I dont know how to use it, in the correct syntax way for this, under the If conndition (assuming that it is possible)?
BulmaSoft
Newbie
 
Posts: 4
Joined: 2018-4-15 @ 17:28

Re: Detecting time in BAT file under DosBox using IF

Postby BulmaSoft » 2018-4-16 @ 19:23

O well - nevermind;
Just to answer "to myself" here:

"If there is something that does not exist but I need it, then usually it's the best when I just sit down and compile it for myself"

That is to say;
I created tiny EXE file for DosBox just for this, so now when called (from a BAT file) it gives an output of the current time (in a seperate file), with the current time of the houf in the filename in HH format.

I call it "Time4bat.exe".

And in Bat file - just execute it
(It will create a new file)
Then - in a Bat file:

If exist 00.TME = it means it is midnight,
If exist 01.TME = it means it is 1h AM,
If exist 02.TME = it means it is 02h AM,
...
And so on.

It was that simple!
And it works!

I wish here to say thanks to: myself!
(I allways knew I was a great person!) :D :D :D
BulmaSoft
Newbie
 
Posts: 4
Joined: 2018-4-15 @ 17:28

Re: Detecting time in BAT file under DosBox using IF

Postby aqrit » 2018-4-16 @ 21:49

I don't believe Dosbox 0.74 returns a correct time...

viewtopic.php?t=35347#p302745
viewtopic.php?f=41&t=12891&start=20#p182255
aqrit
Member
 
Posts: 196
Joined: 2009-6-22 @ 19:53

Re: Detecting time in BAT file under DosBox using IF

Postby mrau » 2018-4-16 @ 23:01

instead of spamming files You could use errorlevels; time will not always be so exact in an emulated environment without synchronisation;
mrau
Oldbie
 
Posts: 997
Joined: 2015-11-28 @ 12:43

Re: Detecting time in BAT file under DosBox using IF

Postby BulmaSoft » 2018-4-17 @ 16:30

I use this DosBox (on Android)
Attachments
db2v.png
BulmaSoft
Newbie
 
Posts: 4
Joined: 2018-4-15 @ 17:28

Re: Detecting time in BAT file under DosBox using IF

Postby BulmaSoft » 2018-4-17 @ 16:33

mrau wrote:instead of spamming files You could use errorlevels; time will not always be so exact in an emulated environment without synchronisation;



If I knew how to do that - I would!

And Yes - DosBox does have the option to synchronise time with the host (on Android).
It is: Time /H
(/H switch)
And it works.

This is the Bat file that is being used (image)
Attachments
db1.png
BulmaSoft
Newbie
 
Posts: 4
Joined: 2018-4-15 @ 17:28



Return to DOSBox General

Who is online

Users browsing this forum: No registered users and 2 guests