반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- sort
- Android
- NUXT
- vuetifyjs
- Electron
- sequelize
- error
- Vue
- 동일 프로그램
- c#
- Vuetify
- kotlin
- f035d
- CSS
- 동일 프로세스
- xlsx
- v-text-field height
- vuejs
- nodejs
- onsen-ui
- naver storage bucket error
- JavaScript
- naver storage
- bucket max-key
- 프로세스 방지
- onsenui
- bucket cors
- MySQL
- v-select
- electron-nuxt
Archives
- Today
- Total
앙큼한 개발기록
[c#] 프로그램 자동실행 본문
프로그램을 작업관리자 - 시작프로그램 등록을 통해서 자동으로 윈도우 시작시 등록 할 수 있으나
regedit에서 시작 프로그램을 등록하는 방식으로
c#에서 코드로 윈도우 시작시 자동으로 프로그램을 등록 할 수 있다.
private void SaveAutoExe()
{
string regPath = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
string programName = "레지스트리에 등록할 key 이름";
#if DEBUG
programName += "_Debug";
#else //릴리즈 모드에서만 실행
programName += "_Release";
#endif
try
{
using (var regKey = GetRegKey(regPath, true))
{
if (regKey.GetValue(programName) == null)
{
// key 에 프로젝트 실행 파일이 없는 경우 등록
var name = AppDomain.CurrentDomain.BaseDirectory + AppDomain.CurrentDomain.FriendlyName;
regKey.SetValue(programName, name);
}
else
{
// key 에 실행 파일이 존재하는 경우
// 삭제 로직
// regKey.DeleteValue(programName, false);
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
exe파일 혹은 설치형 프로그램이 실행되는 exe파일의 경로를 찾아서
레지스트리 안에 등록하면
해당 프로그램이 자동으로 실행된다.
# 프로그램이 자동실행 후 꺼지는 현상
[c#] 윈도우 자동 실행 후 꺼짐
c#을 자동실행 등록후 시스템을 다시시작했을 때 프로그램이 켜졌다 꺼지거나 아예 안켜지는 경우가 있다. # 프로그램 자동실행 등록 https://angkeum.tistory.com/entry/c-%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%A8-%EC%9E
angkeum.tistory.com
'개발' 카테고리의 다른 글
[c#] 프로그램 시작시 관리자권한 (0) | 2023.05.23 |
---|---|
[c#] 윈도우 자동 실행 후 꺼짐 (0) | 2023.05.23 |
[git] error: failed to push some refs to 오류 (0) | 2023.02.09 |
[git] fatal: 정방향이 불가능하므로, 중지합니다. (0) | 2022.06.16 |
서버의 로컬화에 대한 기록(server localization) (0) | 2022.06.08 |
Comments