Windows Registry RunOnce Loop

☆樱花仙子☆ 提交于 2019-12-11 20:41:58

问题


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,

The scenario looks like:

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?


回答1:


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

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.

thanks, mark



来源:https://stackoverflow.com/questions/4693515/windows-registry-runonce-loop

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!