Jump to content

Lokoing for a way to create an internal pause for a set period of time


KrazyKong

Recommended Posts

Hi there. Well it's nearly 3am and I'm still scratching my head trying to solve a problem. I'm building a batch file to be run in DOS/98/ME. The reason being is I'm making a boot disk and thus don't have access to the updated kernel commands.

The problem I'm facing is I can't for the life of me create a way to pause for a set period of time. The command has to be internal and not a call to another .EXE. Otherwise this breaks the "loading" screen graphic I have that while the batch file does it's thing.

The closest I came was with the SET command. But the only way to make a loop that counts for a set period is with the /A switch and this isn't a DOS/98/ME compatible switch.

There are all sorts of .EXE utilities out there like WAIT, SLEEP etc. that do what I want. But since they are an external .EXE when called from the batch file, as I said it breaks the loading screen graphic. So I'm limited to being able to make a pause with IF SET FOR or some other way. But I don't know how to do this too well and thus ended up here.

The best I could come up with was this. It's not pretty but it does seem to work, though it's not based on time, but rather how quickly ones computer can run through it.

@echo off

set counter=*

set

num=***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************

*******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************

*******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************

***********************************************************************************************************************

:loop

set counter=%counter%*

rem echo %counter%

if %counter% == %num% goto end

goto loop

:end

Anyone have any thoughts on this?

Link to comment
Share on other sites


Both of these options are external from the kernel. As I mentioned before ANY call to an .EXE or .COM will interfere with my loading graphic.

I only have 2.88mb to play with here on this boot disk I am making which is based on a WinME (going to change to Win98SE) bootdisk. Thus there are very few if any files other than the dos boot files. All I have are the flash utility and the bios update file.

If you've ever used DOS-LOGO.SYS then you'd know the program I'm trying to overcome.

Thus the command for a pause HAS to be based on an internal DOS command(s).

I know my example from above isn't pretty, but it's roughly working. I'd like to do something a bit more compact and based on real time vs the running time of a completed batch file.

I wish Win98/ME supported SET /A, then I'd be home free. But only Win2K/XP/Vista/7 support the /A switch.

Edited by KrazyKong
Link to comment
Share on other sites

I wish Win98/ME supported SET /A, then I'd be home free. But only Win2K/XP/Vista/7 support the /A switch.

You can then use some nicer "pure DOS" thingies, maybe this will do :unsure::

http://www.ericphelps.com/batch/samples/addition.txt


************************************************************
************************************************************
************************************************************


Doing math in a batch file is a waste of time.
There are no math functions. Luckily, all
most people need to do is increment a counter
of some sort. This can be done via string
comparisons -- something that batch files CAN
do. Here I show code which will increment a
three digit number each time it is called.
Looking at the code, you can see how easy it
would be to extend it to any length. The number
here is actually stored in the environment as
three separate variables E0, E1, and E2. To
refer to the entire number, you'd say this:
%E2%%E1%%E0%

------------------------------------------------------------
@echo off
:: Increments a three digit number
:: Works by comparing each digit
:: E2=hundreds, E1=tens, E0=ones
if [%E2%]==[] set E2=0
if [%E1%]==[] set E1=0
if [%E0%]==[] set E0=0
:E0
if %E0%==9 goto E1
if %E0%==8 set E0=9
if %E0%==7 set E0=8
if %E0%==6 set E0=7
if %E0%==5 set E0=6
if %E0%==4 set E0=5
if %E0%==3 set E0=4
if %E0%==2 set E0=3
if %E0%==1 set E0=2
if %E0%==0 set E0=1
goto DONE
:E1
set E0=0
if %E1%==9 goto E2
if %E1%==8 set E1=9
if %E1%==7 set E1=8
if %E1%==6 set E1=7
if %E1%==5 set E1=6
if %E1%==4 set E1=5
if %E1%==3 set E1=4
if %E1%==2 set E1=3
if %E1%==1 set E1=2
if %E1%==0 set E1=1
goto DONE
:E2
set E1=0
if %E2%==9 set E2=0
if %E2%==8 set E2=9
if %E2%==7 set E2=8
if %E2%==6 set E2=7
if %E2%==5 set E2=6
if %E2%==4 set E2=5
if %E2%==3 set E2=4
if %E2%==2 set E2=3
if %E2%==1 set E2=2
if %E2%==0 set E2=1
goto DONE
:DONE


************************************************************
************************************************************
************************************************************

All the above methods are standalone counters. They
are generally called by other batch files whenever
an incremented number is needed. Here is the opposite
-- a counter batch file that calls a separate process
batch file. The counter here is implemented as a
series of loops. It will count from 000 to 999,
calling a "process.bat" that we'll assume will have
some use for the number!

------------------------------------------------------------
@echo off
if [%1]==[] goto NONE
if [%2]==[] goto ONE
if [%3]==[] goto TWO
goto THREE

:NONE
for %%x in (0 1 2 3 4 5 6 7 8 9) do call %0 %%x
goto DONE

:ONE
for %%x in (0 1 2 3 4 5 6 7 8 9) do call %0 %1 %%x
goto DONE

:TWO
for %%x in (0 1 2 3 4 5 6 7 8 9) do call %0 %1 %2 %%x
goto DONE

:THREE
call PROCESS.BAT %1%2%3
goto DONE

:DONE
------------------------------------------------------------

jaclaz

Link to comment
Share on other sites

Not sure what's that "loading screen graphic", but if it's what I think it is the logical solution is to use a utility that can both delay and show an image.

Link to comment
Share on other sites

shae I'm using DOS-LOGO.SYS which loads and animated LOGO.SYS. It's running pretty good, but I've noticed any external .EXE's or .COM's loaded in the autoexec.bat cause the graphic to no longer display. But internal DOS commands don't interrupt things.

Do you know of another utility or way to show a graphic when running a batch file?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...