How to shut down / restart the computer with a batch file.
Reasoning:
It may be necessary after a batch file is completed its copying or installing process to restart the computer to complete that installation. Below are steps that can be used to restart a computer through a batch file.
Solution:
MS-DOS Users
If the computer needs to be restarted from MS-DOS please see debug page for additional information on how to do this.
Windows 95, Windows 98 and Windows ME Users
Restarting the computer
START C:\Windows\RUNDLL.EXE user.exe,exitwindowsexec
exit
Shut down the computer
C:\Windows\RUNDLL32.EXE user,exitwindows
exit
NOTE: When typing the above two lines, spacing is important. It is also very important that the exit line be placed into the batch file as many times Windows may be unable to restart the computer because of the open MS-DOS window.
Microsoft Windows 98, and Windows ME users may also perform the below command to perform different types of rebooting or shutting down.
rundll32.exe shell32.dll,SHExitWindowsEx n
Where n is equal to one of the below numbers for the proper action.
* 0 - LOGOFF
* 1 - SHUTDOWN
* 2 - REBOOT
* 4 - FORCE
* 8 - POWEROFF
0 comments:
Post a Comment