<--- Turn the page
   
(contents page)
   
Turn the page ---> Another RebootRebooting from a Batch file |
Mmmh, sounds like too good to be done in a batch script. But wait a moment, it is true, and we will soon see how. But frankly speaking, this is not really the case. What we will do is just make a simple .COM file from a batch file, without debug, just echo built-in command and DOS redirection. Examine this: ::Batch script to reboot a PC ::Uses echo built-in and DOS redirection ::Note. This only works in a DOS mode, :: not a Windoze 95 DOS box. @echo "HPS#" > C:\REBOOT.COM ::Please note that you should substitute ::'#' above with ASCII 203, you type ::ALT-203 (hold ALT, while typing 203 on ::numeric keypad @C:\REBOOT.COM ::The script never reach here, your PC ::should be rebooted when REBOOT.COM is invokedWhat does this small script do? Well, first we redirect 'HPS' and an ASCII 203 code to a .COM file, so we could execute it. Then, a call to REBOOT.COM, which should cause a reboot. Ok, we should make this clear, shouldn't we? So let's fire up DEBUG [should be in your DOS directory. ed.] and debug this 'super' tiny program. This is a four one-byte each instruction program: dec ax push ax push bx retf When a .COM file is executed, AX and BX will be 0000h [see DHMag Volume 1 Number 02 page 7 for details on register values on entry to a .COM file.] The first instruction decrease AX, so AX will be 0FFFFh. The second and third instruction push segment and offset on to the stack, and when 'return far' is invoked, the program will return control to address 0FFFFh:0000h, which will reboot. [Be sure to save your batch file as ascii text. DOS' EDIT does well. ed.] ¥ |
<--- Turn the page
   
(contents page)
   
Turn the page ---> Page 4