Jump to content

Shutdown After RunOnceEx


Recommended Posts

I want to time a shutdown to occur 60 seconds after RunOnceEx finishes on XP Professional SP3, but I don't want the annoying, ugly timer box, or any batch windows to appear at all. How can I accomplish this?

Link to comment
Share on other sites


You could use a VBS script as the last entry in your RuOnceEx that will hide the dialog

Save as ShutDown.vbs

WScript.Sleep 60000
CreateObject("Wscript.Shell").Run("shutdown.exe -r -f"),0,True

REG ADD %KEY%\999 /VE /D "Shut Down Computer" /f
REG ADD %KEY%\999 /V 1 /D "%Install%\Shutdown\ShutDown.vbs" /f

Link to comment
Share on other sites

I can't get this to work, I have done everything you said but it still gives me the shutdown screen with 30 seconds to reboot :realmad: I did delete the old reboot info from my cleanup.cmd ?? 3 times I have tried now with the same result, I'm sure it worked the 1st time I tried it :crazy:

Link to comment
Share on other sites

Here try this new code I have tested this and it works

Save As Shutdown.vbs

 WScript.Sleep 60000
Dim Col, Obj, Wmi
Set Wmi = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}!\\.\root\cimv2")
Set Obj = Wmi.ExecQuery("Select * from Win32_OperatingSystem")
For Each Col in Obj
Col.Shutdown(2)
Next

Link to comment
Share on other sites

Thanks gunsmokingman, but that didn't work either :huh: just shut it down and didn't restart :wacko: I just put this "shutdown.exe -r -f -t 00" into a program called "Quick Batch File Compiler" and it worked perfect .. I also put that same command into a .bat file but I prefer using the .exe QBFC made as it seems to happen alot faster ..

Link to comment
Share on other sites

why not use psShutdown frm SysinernalsSuite ?

psshutdown.exe -f -r -t <time> -v 0

Thanks, it hid the countdown, but you did forget to list a very important switch, /accepteula. Without it, an unattended install gets stopped dead. :wacko:

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...