2014-04-22 3 views
0

vb 스크립트를 사용하여 레지스트리 폴더 및 하위 폴더를 삭제하고 싶습니다. 레지 파일에서VBS를 사용하여 레지스트리 폴더 및 하위 폴더 삭제

우리가 할 수있는 스크립트를 다음과 같은 방법 : VB 스크립트를 사용하여 동일한 달성하기 위해 PRR

에서 하위 폴더를 삭제합니다 스크립트 위

[-HKEY_LOCAL_MACHINE\SOFTWARE\abc\prr] 

?

.RegDelete을 사용해 보았습니다.하지만 레지스트리 폴더가 아닌 키에서만 작동한다고 생각합니다.

감사합니다.

+0

Regdelete. \로 끝나면 반드시 키 여야합니다. \ 다음에 값이 없습니다. 키는 폴더입니다. –

+0

@tony bd : 작동하지 않습니다. – jaxb

+0

작동하지 않는 기능 - Sh.RegDelete "HKCR \ .txt \"가 키를 삭제합니다. Sh.RegDelete "HKCR \ .txt \ ShellNew"는 ShellNew 키의 기본값 Sh.RegDelete " HKCR \ .txt \ ShellNew \ NullFile "은 nullfile이라는 값을 삭제합니다. –

답변

0

[경로] RegDelete [키] | [값]

RegDelete의 경로 (Windows에서 찾을 수 있음). Windows 98 Tips and Hacks 페이지의 팁을 참조하면 Windows에서 항상 찾을 수 있습니다.

Nothing 사용자 인터페이스로 RegDelete를 시작합니다. 삭제할 키 또는 값을 입력 할 때 키 또는 값을 거꾸로 쉼표로 묶지 마십시오.

키 삭제할 키입니다. 키는 항상 백 슬래시로 끝납니다. 키에 공백이 있으면 역 콤마로 묶어야합니다. 키와 하위 키가 삭제됩니다.

값 삭제할 값입니다. 값 뒤에 백 슬래시가 없습니다. 키에 공백이 있으면 역 콤마로 묶어야합니다.

새 텍스트 문서에 다음 줄을 복사하고 RegDelete.vbs 파일로 저장하십시오.

'RegDelete.vbs 
'Deletes keys or values from the registry. 
' 
' 
On Error Resume Next 
vbPara=vbCRLF & vbCRLF 
strExplain="RegDelete deletes keys and values from the registry." & vbPara & "Keys must end with a backspace and values must not." & vbPara & "Start without parameters to type in a key or value to delete, or place the key or value on the command line (use inverted commas to surround the key or value if it contains spaces)." & vbPara & "Continue" 
strTitle="Reg Delete" 
Key="" 
Dim silent 
Silent="" 

Dim Sh 
Set Sh = WScript.CreateObject("WScript.Shell") 
ReportErrors "Creating Shell" 

Key=GetKey() 
If Key<>"" then 
    B=Sh.RegRead (Key) 
    If Err.Number=0 Then 
     Sh.RegDelete Key 
     If Err.Number =0 Then 
      If silent<>"yes" Then MsgBox Key & " deleted", vbOKOnly + vbInformation, strTitle 
     Else 
      ReportErrors "DeletingKey" 
     End If 
    Else 
     If Err.Number=-2147024893 then 
      Err.Clear 
      MsgBox Key & " didn't exist", vbOKOnly + vbCritical, strTitle 
     Else 
      ReportErrors "Reading before Deleting Key" 
     End If 
    End If 
End If 

ReportErrors "Main" 

Function GetKey() 
    Dim Ag 
    Set Ag=Wscript.Arguments 
    ReportErrors "Creating Aguments" 
    If Ag.Count=1 then GetKey=Ag(0) 
    Silent="yes" 
    If Ag.Count >1 then sgBox "Too many parameters on command line. Try enclosing the key in a space",vbOKOnly + vbCritical, strTitle 

    If Ag.Count=0 then 
     If MsgBox (strExplain, vbYesNo + vbInformation, strTitle)=6 Then 
      GetKey=InputBox ("Enter the value or key to delete." & vbPara & "Keys must end in a backspace.", strTitle, strNamet1) 
     End If 
    End If 
End Function 

Sub ReportErrors(strModuleName) 
    If err.number<>0 then Msgbox "Error occured in " & strModuleName & " module of " & err.number& " - " & err.description & " type" , vbCritical + vbOKOnly, "Something unexpected" 
    Err.clear 
End Sub