KrazyKong Posted August 4, 2010 Share Posted August 4, 2010 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 offset counter=*set num=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************:loopset counter=%counter%*rem echo %counter%if %counter% == %num% goto endgoto loop:endAnyone have any thoughts on this? Link to comment Share on other sites More sharing options...
jaclaz Posted August 4, 2010 Share Posted August 4, 2010 The traditional way is to use the PING command.http://www.msfn.org/board/index.php?showtopic=26506&st=4http://www.robvanderwoude.com/wait.phpjaclaz Link to comment Share on other sites More sharing options...
KrazyKong Posted August 4, 2010 Author Share Posted August 4, 2010 (edited) 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 August 4, 2010 by KrazyKong Link to comment Share on other sites More sharing options...
jaclaz Posted August 4, 2010 Share Posted August 4, 2010 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 :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=onesif [%E2%]==[] set E2=0if [%E1%]==[] set E1=0if [%E0%]==[] set E0=0:E0if %E0%==9 goto E1if %E0%==8 set E0=9if %E0%==7 set E0=8if %E0%==6 set E0=7if %E0%==5 set E0=6if %E0%==4 set E0=5if %E0%==3 set E0=4if %E0%==2 set E0=3if %E0%==1 set E0=2if %E0%==0 set E0=1goto DONE:E1set E0=0if %E1%==9 goto E2if %E1%==8 set E1=9if %E1%==7 set E1=8if %E1%==6 set E1=7if %E1%==5 set E1=6if %E1%==4 set E1=5if %E1%==3 set E1=4if %E1%==2 set E1=3if %E1%==1 set E1=2if %E1%==0 set E1=1goto DONE:E2set E1=0if %E2%==9 set E2=0if %E2%==8 set E2=9if %E2%==7 set E2=8if %E2%==6 set E2=7if %E2%==5 set E2=6if %E2%==4 set E2=5if %E2%==3 set E2=4if %E2%==2 set E2=3if %E2%==1 set E2=2if %E2%==0 set E2=1goto 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 offif [%1]==[] goto NONEif [%2]==[] goto ONEif [%3]==[] goto TWOgoto THREE:NONEfor %%x in (0 1 2 3 4 5 6 7 8 9) do call %0 %%xgoto DONE:ONEfor %%x in (0 1 2 3 4 5 6 7 8 9) do call %0 %1 %%xgoto DONE:TWOfor %%x in (0 1 2 3 4 5 6 7 8 9) do call %0 %1 %2 %%xgoto DONE:THREEcall PROCESS.BAT %1%2%3goto DONE:DONE------------------------------------------------------------jaclaz Link to comment Share on other sites More sharing options...
osRe Posted August 4, 2010 Share Posted August 4, 2010 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 More sharing options...
KrazyKong Posted August 5, 2010 Author Share Posted August 5, 2010 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now