RunOnceEx - 每次安装后重新启动系统
有什么方法可以在 RunOnceEx.CMD 文件中指定的每个组件安装后重新启动计算机?
我正在为 Windows XP 创建一个无人值守的安装盘,它将在系统上安装 Windows 后安装一些默认软件。我使用 RunOnceEx.cmd 文件来定义需要安装的软件,我想要的是在安装每个软件后重新启动系统。
谢谢和问候,
Is there any way I can reboot my computer after each component installation specified in RunOnceEx.CMD file?
I am creating a unattended setup disk for windows XP which would install some default software after installing windows on the system. I am using RunOnceEx.cmd file to define the software that needs to be installed, what I want is to reboot my the system after installation of each software.
Thanks and regards,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,有。尽管这不是受支持的功能。我做了类似的事情。
这可能不是最奇特的解决方案,但它工作可靠。关键是在开始重新启动过程之前停止 RunOnceEx 进程 (
rundll32.exe
)。如果不停止,Windows 将停止所有进程,然后以未知顺序关闭。如果该顺序意味着在终止 RunOnceEx 进程之前终止我们的“Reboot”进程,它将在被终止之前继续执行 RunOnceEx 列表上的下一项(因此中止,这不是我们想要的)。简单的答案是,添加一个重新启动密钥来终止 RunOnceEx 进程,然后重新启动:
这可能会在下次启动时留下剩余密钥。因此,为了使其看起来更干净,请添加一条在杀死并重新启动之前手动删除密钥的指令:
希望它有所帮助。
编辑:
在 XP 中,您可能必须使用 tskill 而不是 taskkill,但原理是相同的。
Yep there is. Although it's not a supported feature. I do something similar.
This might not be the the fanciest solution but it works reliably. The key is to stop the RunOnceEx process (
rundll32.exe
) before commencing the reboot procedure. If it's not stopped, Windows will stop all processes before shutting down in an unknown order. And if that order means killing our "Reboot" process before killing the RunOnceEx process it will continue on the next item on the RunOnceEx list before being killed (and thus aborted, which is not what we want).The simple answer, add a reboot key that kills the RunOnceEx process and then reboots:
This might leave remnant keys during next startup. So to make it look cleaner, add an instruction to remove the key manually before killing and rebooting:
Hope it helps.
Edit:
In XP you might have to use
tskill
instead oftaskkill
, but the principle is the same.