Jump to content

RunOnce Immediately Launches After Adding


Recommended Posts

I am having difficulty properly configuring the RunOnce commands. I deploy a master sysprepped Windows XP Pro SP3 WIM image to multiple clients using WinPE, and sometimes I would like to add an additional reboot after the initial logon. I've added a registry add command to either the HKLM or HKCU hives (\Software\Microsoft\Windows\CurrentVersion\RunOnce /v launch /t REG_SZ /d "C:\Start\Launch.cmd final") as one of the final Sysprep.INF GUIRunOnce commands . If I add it to the HKLM hive, the RunOnce command launches after reboot, but other autostart (run) applications are held up waiting for the routine to complete, which is undesireable. If I add the command instead to the HKCU hive, then the new RunOnce command attempts to launch immediately after added and prior to the next reboot/logon unless I follow it with a shutdown command, which appears to interrupt the immediate launching. I am using the latter method for now, but dislike the behavior. Can anyone explain this behavior or perhaps offer a solution?

Link to comment
Share on other sites


It's messy, but you can poke entries into HKLM runonce from HKCU runonce, which get processed on the next reboot:

SET KEY=HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce

REG ADD %KEY% /V w /d "reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /V speak /d \"wscript %systemroot%\speak.vbs \\\"installation complete\\\"\" /f" /f

REG ADD %KEY% /V z /D "shutdown.exe -r -f -t 60 -c \"1\"" /f

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