Boot Testing DOS script

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
big pop
Posts: 7
Joined: 23 Jul 2016 02:29

Boot Testing DOS script

#1 Post by big pop » 23 Jul 2016 19:19

Hi,

I've recently started a new job in which I've been doing USB media boot testing, on some laptops running MS-DOS 6.22.

I'm trying to do a sequence of 10 tests on each stick that I'm testing. I've been able to use Debug to write a small reboot.com file, but have become stuck on how to make it reboot for the number of times required.

I apologise in advance, as I haven't had to write batch files for about 10 years. Although, I do have scripting experience from a previous job as a software engineer.

Any help or examples would be greatly appreciated,
Thanks pop
Last edited by big pop on 24 Jul 2016 04:41, edited 1 time in total.

aGerman
Expert
Posts: 4743
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Boot Testing DOS script

#2 Post by aGerman » 24 Jul 2016 04:20

I'm not familiar with MS-DOS. I think you have to change autoexec.bat in order to run another batch file after a reboot. Maybe you have to store the number of the tests done in a file in order to let your code know when to stop.

Regards
aGerman

aGerman
Expert
Posts: 4743
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Boot Testing DOS script

#3 Post by aGerman » 24 Jul 2016 08:47

Something you could try:
1) Create folder C:\test
2) Create a file C:\test\var.dat that contains line set n= without(!) any line break. E.g.
- open a command prompt
- type copy con C:\test\var.dat
- hit Enter
- type set n=
- press Ctrl+Z
- hit Enter
3) Create file C:\test\test.bat

Code: Select all

@echo off
set max=10

C:
cd C:\test
type cnt.dat|find /c /v "">n.dat
if errorlevel 1 set n=0&goto execute
copy var.dat+n.dat n.bat
call n.bat
if not %n%==%max% goto execute
del cnt.dat
exit

:execute
echo.>>cnt.dat
echo reboot index %n%
reboot.com
exit

4) Append line call C:\test\test.bat to your autoexec.bat

If reboot.com reboots your computer it should work but without any warranty (I can't even test it).

Regards
aGerman

big pop
Posts: 7
Joined: 23 Jul 2016 02:29

Re: Boot Testing DOS script

#4 Post by big pop » 24 Jul 2016 09:00

Thanks aGerman Sir, will give this a try.

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Boot Testing DOS script

#5 Post by penpen » 24 Jul 2016 09:09

Nice idea aGerman (type | find); you also could avoid creating files manually.
(Although my post probably is too late: It only has to be done once.)

Code: Select all

@echo off
set max=10
if not exist counting.txt goto testing
echo Completed Test:
type pass.txt
echo:
>nul find "%max%" pass.txt
if errorlevel 1 goto :testing
del counting.txt
del pass.txt
echo All Tests completed.
goto :exit

:testing
>>counting.txt echo _
type counting.txt|>pass.txt find /c /v ""
echo Starting Test:
type pass.txt
reboot.com
echo Error on executing: reboot.com

:exit


penpen

aGerman
Expert
Posts: 4743
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Boot Testing DOS script

#6 Post by aGerman » 24 Jul 2016 09:28

You're right penpen. I had the same idea but then I thought that searching for 10 would match 100 too. Of course that wouldn't even happen because the code stops at 10 :oops:

Regards
aGerman

big pop
Posts: 7
Joined: 23 Jul 2016 02:29

Re: Boot Testing DOS script

#7 Post by big pop » 24 Jul 2016 14:37

I want to thank you both for all the help and suggestions.

I'm hoping to start the testing tomorrow and this information will be invaluable.

I'm going to to try the solution from penpen, which I think will be the answer for my problem.

Thanks again to you both :idea: :roll: :mrgreen:
Pop

aGerman
Expert
Posts: 4743
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Boot Testing DOS script

#8 Post by aGerman » 24 Jul 2016 14:49

Both of the batch files will do the same things. It's important that you add the call in autoexec.bat and that your reboot.com is in the working directory or PATH environment.

Regards
aGerman

big pop
Posts: 7
Joined: 23 Jul 2016 02:29

Re: Boot Testing DOS script

#9 Post by big pop » 25 Jul 2016 06:09

Hi

After using the example from penpen, I get a continuous reboot sequence.

The only way to stop this is to turn off the pc.

Any ideas?

Thanks
pop

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Boot Testing DOS script

#10 Post by penpen » 25 Jul 2016 06:32

It should reboot 10 times in a row only, you could test it by replacing "reboot.exe" with "test.bat" (if that's the name of your batch file).

You have to add the tests (yourself):
Either before executing "reboot.com, or before "echo Completed Test:".
(We don't know your tests, so we couldn't implement it.)


penpen

big pop
Posts: 7
Joined: 23 Jul 2016 02:29

Re: Boot Testing DOS script

#11 Post by big pop » 25 Jul 2016 08:06

Just for clarity, the only test I'm doing is to perform a Boot into DOS, of a particular laptop using a USB stick.

I have 10 USB sticks that I am trying to test for Boot compatibility. This is tested on each of the available USB ports on each laptop.

Hope that makes it a bit clearer. :lol:

Thanks
pop

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Boot Testing DOS script

#12 Post by penpen » 25 Jul 2016 09:53

No. I fear i'm confused now (sorry).

I (now) think you might want to do something like this:
Connect USB-Stick 1 to PC 1, try to boot from USB-Stick 1,
then replace this USB-Stick with USB-Stick 2, try to boot from USB-Stick 2,
and so on.
(Same for PC 2 to N.)

Solution for that:
Just execute reboot.com, after replacing the USB-Stick.
(Am i missing something?)

But I'm nealy sure you wanted to do something different, because
it is no problem to "make it reboot for the number of times required":
You reached the 10. reboot after testing Stick 10.

So describe exactly what you want to do and where the problem is, please.


penpen

aGerman
Expert
Posts: 4743
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Boot Testing DOS script

#13 Post by aGerman » 25 Jul 2016 10:17

I'm confused too.
I'm trying to do a sequence of 10 tests on each stick that I'm testing.

Can you explain step by step how you want to do these tests?
Penpen and me understood that you want to reboot 10 times in series before it stops. Next time you reboot the computer manually it will run another series of ten reboots automatically. That's how our batch scripts are intended to work ...

Regards
aGerman

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Boot Testing DOS script

#14 Post by foxidrive » 25 Jul 2016 20:49

In MSDOS V6.22 you can count in your script like this:


Code: Select all

echo A>>count.txt
find /n "A" <count.txt |find "[11]">nul
if not errorlevel 1 goto end
find /n "A" <count.txt |find "[10]">nul
if errorlevel 1 reboot
:end
del count.txt


1) It appends the letter A into a file, one per line.
2) The find command counts how many A's it finds in the file and then looks for [10] which is the format the find command returns.
3) The errorlevel is set by the last find command and that determines if the roboot.com should run

4) The first line that has [11] inside it is what resets the count by deleting the count.txt file.

It does this on the last boot just after another A has been appended to the count.txt file making 11 in there and the script quits by having no more commands to process.

It's not tested.

I cut my teeth on MSDOS scripting... It was such good fun. :)

MSDOS doesn't have USB support so you must be loading a third party USB driver in config.sys

big pop
Posts: 7
Joined: 23 Jul 2016 02:29

Re: Boot Testing DOS script

#15 Post by big pop » 26 Jul 2016 02:42

Hi

penpen and aGerman, you are both correct in that it is supposed to be a series of 10 Boots of a PC.

For some reason, currently the script carries on continually.

MSDOS sees the USB stick as C: drive, because the BIOS has been set to boot from removable media. Thank you for the suggestion foxidrive, it is worth a try.

regards
pop

Post Reply