Loop (·¹Áö½ºÆ®¸®)

ÁöÁ¤µÈ ·¹Áö½ºÆ®¸® ¼­ºêÅ°ÀÇ ³»¿ëÀ» ÇÑ ¹ø¿¡ Çϳª¾¿ ¿­¶÷ÇÕ´Ï´Ù.

Loop, Reg, RootKey[\Key, Mode]  ; v1.1.21+ (̵̧)
Loop, RootKey [, Key, IncludeSubkeys?, Recurse?]

¸Å°³º¯¼ö

Reg [v1.1.21+]

¹®ÀÚ ±×´ë·ÎÀÇ ´Ü¾î Reg (´ë¼Ò¹®ÀÚ ±¸ºÐ). ÀÌ°ÍÀº º¯¼ö ¶Ç´Â Ç¥Çö½ÄÀÌ µÇ¸é ¾È µË´Ï´Ù. ÀÌ Å°¿öµå°¡ Á¸ÀçÇϸé, Key´Â ¹Ýµå½Ã ½°Ç¥ ´ë½Å¿¡ Á¤»ç¼±À¸·Î RootKey¿Í ºÐ¸®ÇØ¾ß ÇÕ´Ï´Ù. µÑ ¸ðµÎ ÇϳªÀÇ º¯¼ö¿¡ ´ã±æ ¼ö ÀÖ½À´Ï´Ù. ¿¹¸¦ µé¾î, Loop, Reg, HKLM\Software ¶Ç´Â Loop, Reg, %FullPathOfKey%.

RootKey

HKEY_LOCAL_MACHINE (HKLM), HKEY_USERS (HKU), HKEY_CURRENT_USER (HKCU), HKEY_CLASSES_ROOT (HKCR), ¶Ç´Â HKEY_CURRENT_CONFIG (HKCC) Áß Çϳª°¡ µÇ¾î¾ß ÇÕ´Ï´Ù.

¿ø°Ý ·¹Áö½ºÆ®¸®¿¡ Á¢±ÙÇÏ·Á¸é, ÄÄÇ»ÅÍ À̸§°ú ½ÖÁ¡À» ¾Õ¿¡ ¹èÄ¡ÇϽʽÿÀ. ´ÙÀ½ ¿¹Á¦¿Í °°ÀÌ: \\workstation01:HKEY_LOCAL_MACHINE

Key

Å°ÀÇ À̸§ (¿¹, Software\SomeApplication). ºñ¾î Àְųª »ý·«Çϸé, RootKeyÀÇ ³»¿ëÀÌ ¿­¶÷µË´Ï´Ù.

Mode [v1.1.21+]

´ÙÀ½ ±âÈ£·Î ±¸¼ºµË´Ï´Ù:

K: Å°¸¦ Æ÷ÇÔÇÕ´Ï´Ù.
V: °ªÀ» Æ÷ÇÔÇÕ´Ï´Ù. K¿Í V¸¦ ¸ðµÎ »ý·«ÇÏ¸é °ªµéµµ Æ÷ÇԵ˴ϴÙ.
R: ÇÏÀ§Å°·Î Àç±ÍÇØ µé¾î°©´Ï´Ù. RÀÌ »ý·«µÇ¸é, KeyÀÇ ÇÏÀ§Å°ÀÇ Å°¿Í °ªÀº Æ÷ÇÔµÇÁö ¾Ê½À´Ï´Ù.

IncludeSubkeys?

0 (±âº»°ª) Key ¾È¿¡ Æ÷ÇÔµÈ ÇÏÀ§Å°´Â ¿­¶÷ÇÏÁö ¾Ê½À´Ï´Ù (¿ÀÁ÷ °ª¸¸ ¿­¶÷ÇÕ´Ï´Ù).
1 ¸ðµç °ªµé°ú ÇÏÀ§Å°¸¦ ¿­¶÷ÇÕ´Ï´Ù.
2 ÇÏÀ§Å°¸¸ ¿­¶÷ÇÕ´Ï´Ù (°ªÀº ¿­¶÷ÇÏÁö ¾Ê½À´Ï´Ù).

Recurse?
0 (±âº»°ª) ÇÏÀ§Å°¿¡ Àç±ÍÇÏÁö ¾Ê½À´Ï´Ù.
1 ÇÏÀ§Å°¿¡ Àç±ÍÇØ µé¾î°©´Ï´Ù. ±×·¡¼­ ±× ¾È¿¡ Æ÷ÇÔµÈ ¸ðµç °ª°ú Å°¸¦ ¿­¶÷ÇÕ´Ï´Ù.

³íÆò

·¹Áö½ºÆ®¸®-ȸµ¹ÀÌ´Â ·¹Áö½ºÆ®¸® °ª ¶Ç´Â ÇÏÀ§Å°ÀÇ Áý´ÜÀ» ÇÑ ¹ø¿¡ Çϳª¾¿ ó¸®ÇÏ°í ½ÍÀ» ¶§ À¯¿ëÇÕ´Ï´Ù. °ª°ú ÇÏÀ§Å°´Â ¿ª¼øÀ¸·Î (¾Æ·¡¿¡¼­ À§·Î) ¿­¶÷µÇ¹Ç·Î ȸµ¹À̸¦ ¹æÇØÇÏÁö ¾Ê°í ȸµ¹ÀÌ ¾È¿¡ RegDelete¸¦ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.

´ÙÀ½ º¯¼öµéÀÌ ·¹Áö½ºÆ®¸®-ȸµ¹ÀÌ ¾È¿¡ Á¸ÀçÇÕ´Ï´Ù. ³»ºÎ ·¹Áö½ºÆ®¸®-ȸµ¹ÀÌ°¡ ¿ÜºÎ ·¹Áö½ºÆ®¸®-ȸµ¹ÀÌ ¾È¿¡ ½Î¿© ÀÖ´Ù¸é, ³»ºÎ ȸµ¹ÀÌÀÇ ·¹Áö½ºÆ®¸® Ç׸ñÀÌ ¿ì¼± ¼øÀ§¸¦ °®½À´Ï´Ù:

A_LoopRegName ÇöÀç ¿­¶÷µÈ Ç׸ñÀÇ À̸§. °ª À̸§ ¶Ç´Â ÇÏÀ§Å°ÀÇ À̸§ Áß ÇϳªÀÔ´Ï´Ù. °ª À̸§¿¡ °ªÀÌ ÇÒ´çµÇ¾î ÀÖÀ¸¸é Windows RegEditÀÌ "(Default)"·Î º¸¿©ÁÖ´Â °ª À̸§ÀÌ ¿­¶÷µË´Ï´Ù. ±×·¯³ª A_LoopRegName´Â °ª À̸§¿¡ ´ëÇÏ¿© ºñ¿öÁý´Ï´Ù.
A_LoopRegType ÇöÀç ¿­¶÷µÈ Ç׸ñÀÇ À¯Çü, ´ÙÀ½ ´Ü¾î Áß ÇϳªÀÔ´Ï´Ù: KEY (Áï, ÇöÀç ¿­¶÷µÈ Ç׸ñÀº °ªÀÌ ¾Æ´Ï¶ó ÇÏÀ§Å°ÀÔ´Ï´Ù), REG_SZ, REG_EXPAND_SZ, REG_MULTI_SZ, REG_DWORD, REG_QWORD, REG_BINARY, REG_LINK, REG_RESOURCE_LIST, REG_FULL_RESOURCE_DESCRIPTOR, REG_RESOURCE_REQUIREMENTS_LIST, REG_DWORD_BIG_ENDIAN (¾Æ¸¶µµ ´ëºÎºÐÀÇ À©µµ¿ìÁî Çϵå¿þ¾î¿¡¼­´Â º¸±â Èûµé °ÍÀÔ´Ï´Ù). ÇöÀç ¿­¶÷µÈ Ç׸ñÀÌ ¹ÌÁöÀÇ À¯ÇüÀÌ¸é ºñ¾î ÀÖ½À´Ï´Ù.
A_LoopRegKey Á¢±Ù ÁßÀÎ ·çÆ® Å°ÀÇ À̸§ (HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_CURRENT_USER, HKEY_CLASSES_ROOT, ¶Ç´Â HKEY_CURRENT_CONFIG). ¿ø°Ý ·¹Áö½ºÆ®¸® Á¢±ÙÀ» À§ÇÏ¿©, ÀÌ °ªÀº ÄÄÇ»ÅÍ À̸§À» Æ÷ÇÔÇÏÁö ¾Ê½À´Ï´Ù.
A_LoopRegSubKey ÇöÀç SubKeyÀÇ À̸§. ÀÌ Å°´Â Key ¸Å°³º¯¼ö¿Í °°½À´Ï´Ù. ´Ü, Recurse ¸Å°³º¯¼ö°¡ Àç±ÍÀûÀ¸·Î ´Ù¸¥ ÇÏÀ§Å°µéÀ» ŽÇèÇÏ´Â µ¥ »ç¿ëÁßÀÌ¸é ¿¹¿ÜÀÔ´Ï´Ù. ±×·± °æ¿ì¶ó¸é, ÇöÀç ¿­¶÷µÈ Ç׸ñÀÇ Àüü °æ·ÎÀÔ´Ï´Ù. ·çÆ® Å°¸¦ Æ÷ÇÔÇÏÁö ¾Ê½À´Ï´Ù. ¿¹¸¦ µé¾î: Software\SomeApplication\My SubKey
A_LoopRegTimeModified ÇöÀç ÇÏÀ§Å° ¶Ç´Â ±×ÀÇ °ªÀÌ ¸¶Áö¸·À¸·Î º¯°æµÈ ½Ã°£. Çü½ÄÀº YYYYMMDDHH24MISSÀÔ´Ï´Ù. ÀÌ º¯¼ö´Â ÇöÀç ¿­¶÷µÈ Ç׸ñÀÌ ÇÏÀ§Å°°¡ ¾Æ´Ï¸é ºñ¾î ÀÖ½À´Ï´Ù (Áï, A_LoopRegType´Â ´Ü¾î KEY°¡ ¾Æ´Õ´Ï´Ù).

·¹Áö½ºÆ®¸®-ȸµ¹ÀÌ ¾È¿¡¼­ »ç¿ëµÉ ¶§, ´ÙÀ½ ¸í·É¾îµéÀ» »ç¿ëÇϸé ÇöÀç ¿­¶÷µÈ Ç׸ñÀ» ó¸®ÇØ¾ß ÇÒÁö ¸»Áö °£´ÜÇÏ°Ô ¾Ë·ÁÁÙ ¼ö ÀÖ½À´Ï´Ù:

RegRead, OutputVar ÇöÀç Ç׸ñÀ» ÀнÀ´Ï´Ù. ÇöÀç Ç׸ñÀÌ Å°À̸é, ErrorLevel¿¡ 1ÀÌ ¼³Á¤µÇ°í OutputVar´Â ºñ¿öÁý´Ï´Ù.
RegWrite [, Value] ÇöÀç Ç׸ñÀ» ¾¹´Ï´Ù. Value¸¦ »ý·«Çϸé, Ç׸ñÀº ±×ÀÇ À¯Çü¿¡ µû¶ó 0ÀÌ µÇ°Å³ª ºñ¿öÁý´Ï´Ù. ÇöÀç Ç׸ñÀÌ Å°À̸é, ErrorLevelÀº 1ÀÌ ¼³Á¤µÇ°í ´Ù¸¥ È¿°ú´Â ÀüÇô ¾ø½À´Ï´Ù.
RegDelete ÇöÀç Ç׸ñÀ» »èÁ¦ÇÕ´Ï´Ù. ÇöÀç Ç׸ñÀÌ Å°À̸é, ±×ÀÇ ¼­ºêÅ° ±×¸®°í ±× ¾È¿¡ Æ÷ÇÔµÈ °ª±îÁö ÇÔ²² »èÁ¦µË´Ï´Ù.

(À§¿¡ ±â¼úµÈ RootKey ¸Å°³º¯¼ö¸¦ ÅëÇÏ¿©) ¿ø°Ý ·¹Áö½ºÆ®¸®¿¡ Á¢±ÙÇÒ ¶§, ´ÙÀ½ »çÇ×ÀÌ Àû¿ëµË´Ï´Ù:

Blocks, Break, Continue, ±×¸®°í A_Index º¯¼ö (¸ðµç ȸµ¹ÀÌ¿¡ Á¸Àç)¿¡ °üÇÑ ´õ ÀÚ¼¼ÇÑ Á¤º¸´Â Loop¸¦ ÂüÁ¶ÇϽʽÿÀ.

°ü·Ã Ç׸ñ

Loop, Break, Continue, ºí·Ï, RegRead, RegWrite, RegDelete, SetRegView

¿¹Á¦

; ¿¹Á¦: »ç¿ëÀÚ°¡ ŸÀÚÇÑ ÀÎÅÍ³Ý ÀͽºÇ÷η¯ÀÇ URL ÀÌ·ÂÀ» »èÁ¦ÇÕ´Ï´Ù:
Loop, HKEY_CURRENT_USER, Software\Microsoft\Internet Explorer\TypedURLs
    RegDelete

 

; ¿¹Á¦: ÀÛµ¿ÇÏ´Â Å×½ºÆ® ½ºÅ©¸³Æ®:
Loop, Reg, HKEY_CURRENT_USER\Software\Microsoft\Windows, KVR
{
    if a_LoopRegType = key
        value =
    else
    {
        RegRead, value
        if ErrorLevel
            value = *error*
    }
    MsgBox, 4, , %a_LoopRegName% = %value% (%a_LoopRegType%)`n`nContinue?
    IfMsgBox, NO, break
}

 

; ¿¹Á¦: Àüü ·¹Áö½ºÆ®¸®¿¡¼­ ƯÁ¤ °ªÀ»
; Àç±ÍÀûÀ¸·Î ¿­¶÷ÇÏ´Â ¿¹Á¦.
SetBatchLines -1  ; ÃÖ´ë ¼Óµµ·Î °Ë»öÇÕ´Ï´Ù.
RegSearchTarget = Notepad  ; ¼­ºê·çƾ¿¡ ¹«¾ùÀ» °Ë»öÇÏ°í ½ÍÀºÁö ¾Ë¸³´Ï´Ù.
Gosub, RegSearch
return

RegSearch:
ContinueRegSearch = y
Loop, Reg, HKEY_LOCAL_MACHINE, KVR
{
    Gosub, CheckThisRegItem
    if ContinueRegSearch = n ; ¸ØÃß¾î¾ß ÇÕ´Ï´Ù.
        return
}
Loop, Reg, HKEY_USERS, KVR
{
    Gosub, CheckThisRegItem
    if ContinueRegSearch = n ; ¸ØÃß¾î¾ß ÇÕ´Ï´Ù.
        return
}
Loop, Reg, HKEY_CURRENT_CONFIG, KVR
{
    Gosub, CheckThisRegItem
    if ContinueRegSearch = n ; ¸ØÃß¾î¾ß ÇÕ´Ï´Ù.
        return
}
; ÁÖÀÇ: HKEY_USERS¸¦ °Ë»ö ÁßÀ̶ó¸é 
; HKEY_CURRENT_USER´Â °Ë»öÇÒ ÇÊ¿ä°¡ ¾ø´Ù°í ÇÊÀÚ´Â ¹Ï½À´Ï´Ù.
; ¸¶Âù°¡Áö·Î HKEY_LOCAL_MACHINE¸¦ °Ë»ö ÁßÀ̶ó¸é.
; HKEY_CLASSES_ROOTµµ °Ë»öÇÒ ÇÊ¿ä°¡ ¾øÀ» °ÍÀÔ´Ï´Ù.

return

CheckThisRegItem:
if A_LoopRegType = KEY  ; Å° À̸§µµ Á¡°ËÇÏ°í ½Í´Ù¸é ´ÙÀ½ µÎ ÁÙÀ» Á¦°ÅÇϽʽÿÀ.
    return
RegRead, RegValue
if ErrorLevel
    return
IfInString, RegValue, %RegSearchTarget%
{
    MsgBox, 4, , The following match was found:`n%A_LoopRegKey%\%A_LoopRegSubKey%\%A_LoopRegName%`nValue = %RegValue%`n`nContinue?
    IfMsgBox, No
        ContinueRegSearch = n  ; È£ÃâÀÚ¿¡°Ô °Ë»öÀ» ¸ØÃ߶ó°í ¾Ë¸³´Ï´Ù.
}
return