Boot Testing DOS script
Moderator: DosItHelp
Boot Testing DOS script
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
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.
Re: Boot Testing DOS script
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
Regards
aGerman
Re: Boot Testing DOS script
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
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
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
Re: Boot Testing DOS script
Thanks aGerman Sir, will give this a try.
Re: Boot Testing DOS script
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.)
penpen
(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
Re: Boot Testing DOS script
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
Regards
aGerman

Regards
aGerman
Re: Boot Testing DOS script
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
Pop
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



Pop
Re: Boot Testing DOS script
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
Regards
aGerman
Re: Boot Testing DOS script
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
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
Re: Boot Testing DOS script
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
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
Re: Boot Testing DOS script
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.
Thanks
pop
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.

Thanks
pop
Re: Boot Testing DOS script
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
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
Re: Boot Testing DOS script
I'm confused too.
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
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
Re: Boot Testing DOS script
In MSDOS V6.22 you can count in your script like this:
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
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
Re: Boot Testing DOS script
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
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