Jump to content

Why No Reboot?


Recommended Posts

At the end of my main_batch.cmd I want to make a reboot - and I have tried this:

ECHO Restarting the system in 2 minute...

shutdown -r -f -t 60 -c "Windows XP will now restart in 1 minutes"

ECHO.

But it does not reboot... and I don´t know why... Tips please.

/ SwedenXP

Link to comment
Share on other sites


Do you have the following or similiar

COPY "%systemdrive%\Install\Tools\deluser.exe" "%systemroot%\"
COPY "%systemdrive%\Install\Tools\psshutdown.exe" "%systemroot%\"
COPY "%systemdrive%\Install\Tools\pskill.exe" "%systemroot%\"

in one of your first .cmd files?

Link to comment
Share on other sites

Doesn't always work

link

ECHO Restarting the PC in 1 minute...

psshutdown.exe -r -t 60 -f -m "Windows XP will now restart in 1 minute, this will give enough time for the shortcuts to update and for the shell to fully load before its ready to restart!"

You can customize the message inside the " ", and change the number 60 to how many seconds you want to wait before it restarts. On a 800MHz system (Which I tested on) 30-45 seconds was enough for the shell to fully load, but use a higher value to be on the safe side.

Note: For PsShutdown to function, you will require a Network Card, with installed drivers. If you are unable to get your NIC drivers to install during Windows Setup then you may be out of luck. Sorry!

Instead I use Shutdown

LINK

==>shutdown.exe /?

shutdown 1.0 for Windows XP - September 2nd, 2001

Copyright© 2000-2001 Andrej Budja, www.budja.com/shutdown

This program is FREEWARE.

Usage:   shutdown [-lkurhs][-f] [-c] [-t sec]

                 -l:     Log Off.

                 -u:     Shutdown (Turn Off).

                 -r:     Restart.

                 -h:     Hibernate.

                 -s:     Stand By (Sleep).

                 -f:     Force the action.

                 -c:     Cancel a running shutdown.

                 -t sec: Delay for number of seconds.

Examples:

shutdown -l -f: Logs off current user and forces quick shutdown of applications

shutdown -s -t 30: Initates standby in 30 seconds

shutdown -c: Cancels all initiated actions

put this in your *.cmd

SHUTDOWN.EXE -r -t 30 -f

:) works fine

Link to comment
Share on other sites

Create a .vbs file and insert:

Btn = WshShell.Popup ("Windows XP will now restart in 1 minute!",60," - Important ! Reboot required - ",36)
If Btn = 7 Then Wscript.Quit
Set wmi = GetObject("winmgmts:{(Shutdown)}")
Set objset = wmi.instancesof("win32_operatingsystem")
For each obj in objset
Set os = obj :  exit For
Next
os.reboot
Wscript.Quit

at the end of the script.

if you want shutdown change os.reboot to os.shutdown

if you want to abort press 'NO'

So, you don't need an external program.

Link to comment
Share on other sites

I'm having the exact same problem... using the "standard" shutdown.exe, the system doesn't restart... any ideas why ??

I could of course just use psshutdown.exe, but the other method is easier, since shutdown.exe comes with Windows...

Link to comment
Share on other sites

Also, you could just use the shutdown utility that came with Windows (found in

C:\WINDOWS\system32\).

So your *.cmd file would look like:

cls
@echo off
echo.
start /wait %systemroot%\system32\shutdown.exe -r -c "Restarting the PC to Facilitate Changes" -t 60 -f
echo.
exit

Of course, the comment "Restarting......" can be changed to whatever you like (maximum 127 characters), and the time can be 45-60 seconds.

(For a list of all the switches, type C:\WINDOWS\system32\shutdown.exe /? from a command prompt. Also note: The entire command should be in ONE LINE.)

Link to comment
Share on other sites

Try adding the '.exe' to shutdown, so it appears as 'shutdown.exe'.

I've often had problems where my batch script would loop when shutdown didn't have an .exe suffixed to it.

I already had "shutdown.exe -r -f -t 60 etc. etc." in my .cmd file and it didn't work... and it's not just a problem with VPC, that's been tested :)

I could of course just revert to using psshutdown.exe again, but this sorta bugs me...

Link to comment
Share on other sites

What exactly didn't work, Rancor?

Did the PC not reboot?

Did it login before rebooting?

Did it login and restarted after the countdown finished?

This is a copy of my Reboot.cmd which worked perfectly:

cls
@echo off
echo.
shutdown.exe -r -t 60 -f -c "Whew! I thought it would never end."
pause
echo.
exit

Notice the all important "pause" which makes the command window hang if you don't push any button.

It will keep hanging until the time runs out, then TA DA!

Link to comment
Share on other sites

What exactly didn't work, Rancor?

Did the PC not reboot?

Did it login before rebooting?

Did it login and restarted after the countdown finished?

This is a copy of  my Reboot.cmd which worked perfectly:

cls
@echo off
echo.
shutdown.exe -r -t 60 -f -c "Whew! I thought it would never end."
pause
echo.
exit

Notice the all important "pause" which makes the command window hang if you don't push any button.

It will keep hanging until the time runs out, then TA DA!

The command windows shows and runs a couple of "rmdir" commands and such and then closes, but seems to skip the shutdown.exe-line completely ...

I haven't read anywhere that it needs a "pause" command... is that really necessary ?? or is it just the psshutdown.exe utility that's able to run without pausing maybe ??

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...