Reply
Mon 10 Nov, 2003 11:30 pm
if it is possible, what is the command to reboot the computer in an MS-DOS batch file?
Hey there Josh. Sorry, I don't know the answer but just wanted to drop in and say hello :-)
hey Montana. I decided I'm not gonna do that thing to the guys computer afterall. You guys were right.
Why do you need the DOS command to reboot a PC?
Sounds like you're still up to your old tricks and have just changed the tune.
What will you be using the batch file for?
I want to learn to write batch files thats all!! I've been doing HTML for a while now and I feel I want to learn something new. I am also looking for a book on C++. I have the BASICS of Javascript in HTML but I think it would be better to move onto Java
did you read what I already wrote? I said I'm ot doing that any more. |You were right
Hi Josh,
MS-DOS batch language doesn't provide a means of restarting a system. You can, however, restart a system from within a batch file by calling a program that performs the task.
If you still want to perform this from within a prank email it means you'd have to have a 2nd attachment (the reboot program), but even then it wouldn't work because the .bat file wouldn't be able to find the reboot program.
Josh wrote:I want to learn to write batch files thats all!! I've been doing HTML for a while now and I feel I want to learn something new. I am also looking for a book on C++. I have the BASICS of Javascript in HTML but I think it would be better to move onto Java
Josh,
You might find the web-based training courses here of interest to you. I learned HTML and a few other things using these training courses. They teach almost anything you can think of that is related to computers. I highly recommend it.
This is a list of all their courses.
http://www.techies.com/TechPro.html
Also, here's a list of C++ books from Amazon.com.
List of Learning C++ books
If you can't afford to buy one, you can at least browse them then go check it out at the library.
Here's a good site for learning how to write DOS batch files.
http://www.chebucto.ns.ca/~ak621/DOS/BatBasic.html
hey guys, I found this on another site just now, apparently it works on windows 95 or 98:
start RUNONCE.EXE -q. it says it reboots the computer in batch files, but i've been told there isn't a command for this. and what is RUNONCE.EXE anyway? and what dies the -q mean?
Yeah. Like I was saying you can call a separate program (such as runonce.exe) to perform the reboot for you.
Runonce has a number of uses, but yeah the '-q' restart switch for it will only work with Win9X/ME. The runonce.exe -q command is actually supposed to restart the computer after a 15 second delay.
Here's a better Win9X/ME-only program call..
rundll32.exe shell32.dll,SHExitWindowsEx n
n should be one of the following numbers: 0 - logoff, 1 - shutdown, 2 - reboot, 4 - force, 8 - poweroff
Those can be combined to get different results. E.g. a forced reboot would use 6. Just keep in mind that using the force option can cause programs to lose data.
But I'd not recommend using any of these methods because you're limiting the batch file's versatility. You should try to track yourself down a small reboot program that works with all versions of Windows.
Better yet, look into application programming or the windows scripting host, and forget about MS-DOS batch files.
Yes, speaking from experience that probably most people in here have, Batch files are very limited. Their greatest benefit is being easy to write and very good timesavers for very repetitive tasks, and you can use them to string together other true programs which have much greater functionality. The mark of a good batch writer is the ability to find the secondary programs codes and characteristics so that they run in the proper way every time. There are many pages out there that catalogue and describe batch commands and scripting. I've found that for every answer I've found in a forum I've found ten in other pages already out there. Go to Google.com and search "batch file" and you'll be surprised.
Now go out and do it yourself... You'll get much more confidence by figuring out most of the stuff yourself. Save the really tough problems for the forums, that way you'll know more and will appreciate and understand the answers you get even more...