October 15, 200322 yr 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
October 15, 200322 yr Do you have the following or similiarCOPY "%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?
October 15, 200322 yr Author No, non of the above mentioned. Thought that shutdown was an internal windows command / SwedenXP
October 15, 200322 yr I am a newbie around here, but what i gleaned from here and use is as above.Once the pssshutdown is in your system it works fine.Unless I am corrected try that. Cant remember where I got those files though <scratches head>edit: found ithttp://www.sysinternals.com/ntw2k/freeware...sshutdown.shtml
October 15, 200322 yr Doesn't always worklink 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 ShutdownLINK==>shutdown.exe /?shutdown 1.0 for Windows XP - September 2nd, 2001Copyright© 2000-2001 Andrej Budja, www.budja.com/shutdownThis 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 applicationsshutdown -s -t 30: Initates standby in 30 secondsshutdown -c: Cancels all initiated actionsput this in your *.cmdSHUTDOWN.EXE -r -t 30 -f works fine
October 15, 200322 yr 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.QuitSet wmi = GetObject("winmgmts:{(Shutdown)}")Set objset = wmi.instancesof("win32_operatingsystem")For each obj in objsetSet os = obj : exit ForNextos.rebootWscript.Quitat the end of the script.if you want shutdown change os.reboot to os.shutdownif you want to abort press 'NO'So, you don't need an external program.
October 15, 200322 yr 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...
October 15, 200322 yr 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.
October 16, 200322 yr Also, you could just use the shutdown utility that came with Windows (found inC:\WINDOWS\system32\).So your *.cmd file would look like:cls@echo offecho.start /wait %systemroot%\system32\shutdown.exe -r -c "Restarting the PC to Facilitate Changes" -t 60 -fecho.exitOf 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.)
October 18, 200322 yr 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...
October 19, 200322 yr 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 offecho.shutdown.exe -r -t 60 -f -c "Whew! I thought it would never end."pauseecho.exitNotice 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!
October 22, 200322 yr 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 offecho.shutdown.exe -r -t 60 -f -c "Whew! I thought it would never end."pauseecho.exitNotice 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 ??
Create an account or sign in to comment