본문 바로가기

IT 살이/04. 기술 - 프로그래밍

시스템시작 또는 사용자가 로그인시 자동으로 프로그램 실행시키기

출근해서 컴을 켜자 RSS리더기의 알림창이 쑤욱 올라온다. 누가 블로그에 포스트를 새로 하나 올린 모양이다. 제목을 클릭해서 해당 블로그로 가 보니 다음과 같은 내용이 있다. 시스템을 시작하거나 또는 사용자가 로그인하면 자동으로 어떤 일을 할 수 있도록 설정할 수 있다는 것인데, 유용한 팁이 될 것 같아 이곳에 캐시해둔다.
원본 주소는 이곳(http://blogs.msdn.com/junfeng/archive/2006/09/19/761765.aspx)을 참조하면 된다.

참고로 달봉이 노트북의 레지스트리 키 HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run 을 보면 다음처럼 컴이 부팅될때 시작되는 프로그램들이 등록되어 있는 것을 볼 수 있다.
1395199481


Run/RunOnce/RunOnceEx Registry Key
Run\RunOnce\RunOnceEx are documented ways to automatically run certain tasks when system startup or a user logs in. 

Run\RunOnce keys are documented here:

Run and RunOnce Registry Keys
http://windowssdk.msdn.microsoft.com/en-us/library/ms723554.aspx

RunOnceEx is documented here:

Syntax for the RunOnceEx Registry Key
http://support.microsoft.com/default.aspx?kbid=232509

Description of the RunOnceEx Registry Key
http://support.microsoft.com/kb/310593

You can also specify RunOnce when install device drivers

KB 281820: INFO: Specifying RunOnce in Device INF Files
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q281820  

Be careful about RunOnce registry key: It may run before system restart.  

According to KB 281829, RunOnce registry key will run in the following cases:  

1. At the end of installation through InstallFromHinfSection even in the cases where you must restart the computer.

2. After the default processing of DIF_INSTALLDEVICE even if you must restart the computer (with the exception of server-side processing).

3. After the system has been restarted.  

This means, RunOnce registry key entries may be executed immediately after a device driver installation, which may happen at any given time.  

If your RunOnce entry needs to be executed after certain event, make sure you write the RunOnce registry key after the event, or if you cannot do so, use RunOnceEx. Otherwise you may experience random failures.

'IT 살이 > 04. 기술 - 프로그래밍' 카테고리의 다른 글

[연재 01] XAML Browser Application- 사설(辭說)하기  (0) 2009.04.23
13 Where Are We?  (0) 2009.04.23
12 PageFunction  (0) 2009.04.23