Often we come across situations wherein our batch files would be needing to reboot Windows for a variety of reasons. A few of them would be like:
(1) Setup files have been updated whose changes can take effect only after a reboot of the system has happened.
(2) A file got locked or a Windows service is not responding. If such a step is detected in the installation procedure, the only remedial step that might be left is to have the system restarted and then to resume the installation.
Quick ways to reboot Windows
This tip ushers to present you with simple ways to achieve Windows restart through quick commandline options without depending on or asking to the user to manually reboot the box.
iisreset /timeout:1 /rebootonerror: This would attempt to restart IIS Services within a timeframe mentioned in the timeout attribute. If this fails, the system itself is given a reboot.
shutdown -r: Windows XP ships with a neat little utility to restart/shutdown/logoff a user. A quick shutdown -r would help to restart a Windows XP box. Appending a -m \\computername would have the restart command sent to the computer named as computername, subject to the logged on user having restart privileges on the target machine.
Taking help of RunDll32
The rundll32.exe also lends a great helping hand in rebooting, shutting down and logging off the user. However, the arguments to be passed for each version of Wndows (like NT, XP etc) might be too much varying and overwhelming for a quick and more generic tip. However, I would like a share a URL which presents a comprehensive table on the capabilities of rundll32.
Check it out here
Trust this helps a beginner-user with quick and easy tips in shutting down/rebooting his system through simple commandline.