SwedenXP Posted October 15, 2003 Share Posted October 15, 2003 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 More sharing options...
pulpfixtion Posted October 15, 2003 Share Posted October 15, 2003 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? Link to comment Share on other sites More sharing options...
SwedenXP Posted October 15, 2003 Author Share Posted October 15, 2003 No, non of the above mentioned. Thought that shutdown was an internal windows command / SwedenXP Link to comment Share on other sites More sharing options...
pulpfixtion Posted October 15, 2003 Share Posted October 15, 2003 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 Link to comment Share on other sites More sharing options...
Ypsos Posted October 15, 2003 Share Posted October 15, 2003 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 Link to comment Share on other sites More sharing options...
Westi Posted October 15, 2003 Share Posted October 15, 2003 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. Link to comment Share on other sites More sharing options...
Rancor Posted October 15, 2003 Share Posted October 15, 2003 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 More sharing options...
SwedenXP Posted October 15, 2003 Author Share Posted October 15, 2003 I am now trying the psshutdown.exe - hope it works./ SwedenXP Link to comment Share on other sites More sharing options...
Aaron Posted October 15, 2003 Share Posted October 15, 2003 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. Link to comment Share on other sites More sharing options...
DarkBringer Posted October 16, 2003 Share Posted October 16, 2003 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.) Link to comment Share on other sites More sharing options...
Sunil Posted October 16, 2003 Share Posted October 16, 2003 Try the solution ArronXp Suggsted, that should rectify the prob. Link to comment Share on other sites More sharing options...
SwedenXP Posted October 16, 2003 Author Share Posted October 16, 2003 Thanx gentlemen both variants works beautifully! / SwedenXP Link to comment Share on other sites More sharing options...
Rancor Posted October 18, 2003 Share Posted October 18, 2003 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 More sharing options...
DarkBringer Posted October 19, 2003 Share Posted October 19, 2003 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! Link to comment Share on other sites More sharing options...
Rancor Posted October 22, 2003 Share Posted October 22, 2003 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 ?? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now