728x90
반응형


@ 마우스 우 클릭 시 현재 위치 CMD 실행 ( 컨텍스트 메뉴 추가 )


마우스 우 클릭 시 현재 위치 CMD 실행.reg



Windows Registry Editor Version 5.00


; // 마우스 우클릭시 현재 위치 CMD 실행 버튼

[HKEY_CLASSES_ROOT\Directory\Background\shell\run_cmd]

@="▶ CMD 실행"


[HKEY_CLASSES_ROOT\Directory\Background\shell\run_cmd\command]

@="cmd.exe /s /k pushd \"%V\""



레지 삭제방법

[-HKEY_CLASSES_ROOT\Directory\Background\shell\run_cmd]



@ "SHIFT" 키 누르고 마우스 우클릭시 관리자 권한 CMD 실행 ( 컨텍스트 메뉴 추가 )


SHIFT 키 누르고 마우스 우클릭시 관리자 권한 CMD 실행.reg



Windows Registry Editor Version 5.00


[HKEY_CLASSES_ROOT\Directory\Background\shell\run_cmd_uac]

"HasLUAShield"=""

@="@shell32.dll,-8506"

"Extended"=""

@="▶ CMD 실행"


[HKEY_CLASSES_ROOT\Directory\Background\shell\run_cmd_uac\command]

@="cmd.exe /s /k pushd \"%V\""



레지 삭제방법

[-HKEY_CLASSES_ROOT\Directory\Background\shell\run_cmd_uac]







 @ Memo

레지스터





http://insurang.tistory.com

728x90
반응형
728x90
반응형

[ WPF & C# (C Sharp) ] - REG에 읽기 / 쓰기 / 지우기 ( 삭제하기 )



 @ REG에 읽기 / 쓰기 / 지우기 ( 삭제하기 )

레지스트리에 값을 입력하기 편하도록 조금 수정해 보았다.



@ cs


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
31
32
33
34
35
36
37
38
39
40
        #region // 펑션 레지스트리 가져오기 및 쓰기
        // Reg_Read
        private string Reg_Read(string rPath, string rKey)
        {
            RegistryKey reg = Reg_Category(rPath);
            reg = reg.OpenSubKey(rPath.Substring((rPath.IndexOf("\\"+ 1), rPath.Length - (rPath.IndexOf("\\"+ 1)), true);
            if (reg == nullreturn "";
            else return Convert.ToString(reg.GetValue(rKey));
        }
 
        // Reg_Write
        private void Reg_Write(string rPath, string rKey, string rVal, RegistryValueKind rKnd) // 키, 값, 종류
        {
            RegistryKey reg = Reg_Category(rPath);
            reg = reg.CreateSubKey(rPath.Substring((rPath.IndexOf("\\"+ 1), rPath.Length - (rPath.IndexOf("\\"+ 1)), RegistryKeyPermissionCheck.ReadWriteSubTree);
            reg.SetValue(rKey, rVal, rKnd);
            reg.Close();
        }
 
        // Reg_Del
        private void Reg_Del(string rPath, string rKey, string rVal) // 키, 값, 종류
        {
            RegistryKey reg = Reg_Category(rPath);
            reg = reg.OpenSubKey(rPath.Substring((rPath.IndexOf("\\"+ 1), rPath.Length - (rPath.IndexOf("\\"+ 1)), true);
            if (reg != null) reg.DeleteValue(rKey);
        }
 
        // Reg_Category
        private RegistryKey Reg_Category(string rPath)
        {
            RegistryKey reg = null;
            if (rPath.StartsWith("HKEY_CLASSES_ROOT")) reg = Registry.ClassesRoot;
            if (rPath.StartsWith("HKEY_CURRENT_USER")) reg = Registry.CurrentUser;
            if (rPath.StartsWith("HKEY_LOCAL_MACHINE")) reg = Registry.LocalMachine;
            if (rPath.StartsWith("HKEY_USERS")) reg = Registry.Users;
            if (rPath.StartsWith("HKEY_CURRENT_CONFIG")) reg = Registry.CurrentConfig;
            return reg;
        }
        #endregion
 
cs



 @ ...

이렇게 만들어 놓으면 무지 편할줄 알았다...

근데... 그닥 편하지 않다. ㅠㅠ

레지 1~2개 시에도 그냥 그렇고, 대량 등록 시에도 그냥 그렇다.

참 애매하고, 이상한 코드다.

다음에 시간 날 때 정리 함 해봐야 되겠다.

어디 좋은 소스 아시는분~





http://insurang.tistory.com


728x90
반응형
728x90
반응형


 WPF & C# - 레지스트리에 값 읽기 쓰기 지우기 삭제하기 ( 입력 삭제 레지 Regstry RegstryKey Reg REGEDIT )


 

@ 레지스트리에 값 읽기 쓰기 지우기 삭제하기


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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
           using Microsoft.Win32;   // 추가 되어야 한다.
 
 
            if (Reg_read(rPath, rKey) == rVal) { CheckBox1.IsChecked = true; }   //  <== 폼 로드 시 넣어주면 좋다.
 
 
        string rPath = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run";
        string rKey = "Touch-Util";
        string rVal = Environment.CurrentDirectory + "\\TOUCH-UTIL(Ver2).exe";
 
        private void CheckBox1_Checked(object sender, RoutedEventArgs e)
        {
            if (Reg_read(rPath, rKey) != rVal)
            {
                Reg_write(rPath, rKey, rVal, RegistryValueKind.String);
                MessageBox.Show("시작프로그램 등록~!");
            }
        }
 
        private void CheckBox1_Unchecked(object sender, RoutedEventArgs e)
        {
            Reg_del(rPath, rKey, rVal);
            MessageBox.Show("시작프로그램 제거");
        }
        #region // 펑션 레지스트리 가져오기 및 쓰기
        // 레지스트리 정보 가져오기
        private string Reg_read(string rPath, string rKey)
        {
            RegistryKey reg = null;
            if (rPath.StartsWith("HKEY_CLASSES_ROOT")) reg = Registry.ClassesRoot;
            if (rPath.StartsWith("HKEY_CURRENT_USER")) reg = Registry.CurrentUser;
            if (rPath.StartsWith("HKEY_LOCAL_MACHINE")) reg = Registry.LocalMachine;
            if (rPath.StartsWith("HKEY_USERS")) reg = Registry.Users;
            if (rPath.StartsWith("HKEY_CURRENT_CONFIG")) reg = Registry.CurrentConfig;
            reg = reg.OpenSubKey(rPath.Substring((rPath.IndexOf("\\"+ 1), rPath.Length - (rPath.IndexOf("\\"+ 1)), true);
            if (reg == nullreturn "";
            else return Convert.ToString(reg.GetValue(rKey));
        }
        //레지스트레에 정보 쓰기
        private void Reg_write(string rPath, string rKey, string rVal, RegistryValueKind rKnd) // 키, 값, 종류
        {
            RegistryKey reg = null;
            if (rPath.StartsWith("HKEY_CLASSES_ROOT")) reg = Registry.ClassesRoot;
            if (rPath.StartsWith("HKEY_CURRENT_USER")) reg = Registry.CurrentUser;
            if (rPath.StartsWith("HKEY_LOCAL_MACHINE")) reg = Registry.LocalMachine;
            if (rPath.StartsWith("HKEY_USERS")) reg = Registry.Users;
            if (rPath.StartsWith("HKEY_CURRENT_CONFIG")) reg = Registry.CurrentConfig;
 
            reg = reg.CreateSubKey(rPath.Substring((rPath.IndexOf("\\"+ 1), rPath.Length - (rPath.IndexOf("\\"+ 1)), RegistryKeyPermissionCheck.ReadWriteSubTree);
            reg.SetValue(rKey, rVal, rKnd);
            reg.Close();
        }
        private void Reg_del(string rPath, string rKey, string rVal) // 키, 값, 종류
        {
            RegistryKey reg = null;
            if (rPath.StartsWith("HKEY_CLASSES_ROOT")) reg = Registry.ClassesRoot;
            if (rPath.StartsWith("HKEY_CURRENT_USER")) reg = Registry.CurrentUser;
            if (rPath.StartsWith("HKEY_LOCAL_MACHINE")) reg = Registry.LocalMachine;
            if (rPath.StartsWith("HKEY_USERS")) reg = Registry.Users;
            if (rPath.StartsWith("HKEY_CURRENT_CONFIG")) reg = Registry.CurrentConfig;
            reg = reg.OpenSubKey(rPath.Substring((rPath.IndexOf("\\"+ 1), rPath.Length - (rPath.IndexOf("\\"+ 1)), true);
            reg.DeleteValue(rKey);
        }
        #endregion
cs


@ 시작프로그램 등록


시작프로그램 등록을 위한 부분이다.

아래 내용을 참고해서 레지스트리에 등록하면 된다.

현장에서 작업을 하다보니 시작프로그램 폴더에 넣었는데도 작동이 되지 않는경우도 있었다.

원인은 발견하지 못했지만, 레지스트리에 등록해서 올리니 정상적으로 작동했었던 기억이 있다.

가급적이면 폴더에 넣기보다 레지스트리에 등록해서 사용하는것을 추천한다.



시작프로그램 레지스트리 주소와 폴더 위치 ( Startup / REGEDIT / RunOnce )

 

[ 사용자 계정 ]

 - 시작프로그램 폴더
%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup

 

 - 레지스트리

지속용 : HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run 
일회용 : HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce

 

[ 전체 사용자 ]
 - 시작프로그램 폴더
%ProgramData%\Microsoft\Windows\Start Menu\Programs\Startup

 - 레지스트리

지속용 : HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
일회용 : HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce

 


출처: http://insurang.tistory.com/34 [insurang.tistory.com]


 @ 레지스트리에 값을 쓰기 일기 를 편하게 하기위해

레지스트리에 값을 편하게 쓰고 읽기위해서 위와같이 코딩을 해보았다.

어찌보면 기본적으로 있는것 자체도 많이 편하긴 하다.

하지만, 저렇게 작업을 해놓고나니 다량으로 작업하기에 편해 졌다.


물론... 솔직히 좀 허접하기는하다.

좀 더 손 봐야하는데... 이쁘게 정리하기에는... 실력도 부족하고, 귀찮기도하다.

정확하게 잘 작동하면 그것으로 만족하려고 한다. ^^



간혹 레지스트리 등록을 위해서는 사용가권한이 ADMIN 권한을 획득해야 하는 경우가 있다.


C# 이라면 아래 링크를 클릭하여 참고한다.

http://insurang.tistory.com/108


VB.NET 이라면 아래 링크를 클릭하여 참고한다.

http://insurang.tistory.com/54






http://insurang.tistory.com


728x90
반응형

+ Recent posts