Windows注册表RunOnce循环 [英] Windows Registry RunOnce Loop
问题描述
我所处的环境中,启动菜单中的应用程序和运行注册表项"不会执行任何操作,但是RunOnce会执行任何操作,因此我制作了小脚本来启动要在启动时运行的应用程序,然后重新编写注册表项.但是,当我登录并运行脚本时,在启动我的应用程序并重新编写注册表项后退出,Windows似乎再次运行它,
I'm in an environment where apps in the start up menu and Run registry key wont execute anything, but RunOnce will, so I made small script to start the application I want to run on startup then re-write the registry key. However, when I login and teh script runs then exits after firing off my app and re-writing the registry key, windows seems to run it again,
场景如下:
我登录->我的脚本启动并加载记事本->我的脚本重新编写注册表项->我的脚本退出-> Windows再次运行我的脚本->它加载记事本->我的脚本重新编写注册表项->我的脚本存在->循环
i login -> my script fires and loads notepad -> my script re-writes registry key -> my script exits -> windows runs my script again -> it loads notepad -> my script re-writes registry key -> my script exists -> loop
有没有一种方法可以解决这个问题?
Is there a way I can achieve this with out the loop?
推荐答案
可能并非没有在脚本中的某个地方引入sleep语句.这些密钥的文档特别声明在执行时不写回该密钥(请参阅
probably not without introducing a sleep statement somewhere in your script. the documentation for these keys specifically state to not write back to the key while executing (see http://msdn.microsoft.com/en-us/library/aa376977(VS.85).aspx for details).
您没有提到正在运行的Windows版本,但如果运行的是Vista或更高版本(我相信),则应该能够创建一个定期执行的计划任务以在用户登录时运行.
you don't mention what version of windows you are running, but if you are running Vista or higher (I believe), you should be able to create a recurring scheduled task to run at user logon.
谢谢, 标记
这篇关于Windows注册表RunOnce循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!