RegDelete Method
This page is specific to:.NET Framework Version:2.03.0
Windows Script Host
RegDelete Method

Deletes a key or one of its values from the registry.

object.RegDelete(strName)
Arguments

object

WshShell object.

strName

String value indicating the name of the registry key or key value you want to delete.

Remarks

Specify a key-name by ending strName with a final backslash; leave it off to specify a value-name. Fully qualified key-names and value-names are prefixed with a root key. You may use abbreviated versions of root key names with the RegDelete method. The five possible root keys you can use are listed in the following table.

Root key Name

Abbreviation

HKEY_CURRENT_USER

HKCU

HKEY_LOCAL_MACHINE

HKLM

HKEY_CLASSES_ROOT

HKCR

HKEY_USERS

HKEY_USERS

HKEY_CURRENT_CONFIG

HKEY_CURRENT_CONFIG

Example

The following code creates a key and two values, reads them, and deletes them.

Dim WshShell, bKey
Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.RegWrite "HKCU\Software\ACME\FortuneTeller\", 1, "REG_BINARY"
WshShell.RegWrite "HKCU\Software\ACME\FortuneTeller\MindReader", "Goocher!", "REG_SZ"

bKey = WshShell.RegRead("HKCU\Software\ACME\FortuneTeller\")
WScript.Echo WshShell.RegRead("HKCU\Software\ACME\FortuneTeller\MindReader")

WshShell.RegDelete "HKCU\Software\ACME\FortuneTeller\MindReader"
WshShell. RegDelete"HKCU\Software\ACME\FortuneTeller\"
WshShell.RegDelete "HKCU\Software\ACME\"
var WshShell = WScript.CreateObject("WScript.Shell");

WshShell.RegWrite ("HKCU\\Software\\ACME\\FortuneTeller\\", 1, "REG_BINARY");
WshShell.RegWrite ("HKCU\\Software\\ACME\\FortuneTeller\\MindReader", "Goocher!", "REG_SZ");

var bKey =    WshShell.RegRead ("HKCU\\Software\\ACME\\FortuneTeller\\");
WScript.Echo (WshShell.RegRead ("HKCU\\Software\\ACME\\FortuneTeller\\MindReader"));

WshShell.RegDelete ("HKCU\\Software\\ACME\\FortuneTeller\\MindReader");
WshShell.RegDelete ("HKCU\\Software\\ACME\\FortuneTeller\\");
WshShell.RegDelete ("HKCU\\Software\\ACME\\");


Applies To:

See Also

Reference

© 2009 Microsoft Corporation. All rights reserved.   사용약관 | 상표 | 개인정보취급방침 및 청소년보호정책
Page view tracker
간편한 Lightweight 평가
x
Lightweight는 사용자가 요청한 SearchBox 및 기본 코드 언어 선택 기능을 추가하여 ScriptFree(loband)에 구축됩니다.
SearchBox가 좋습니까?
탭 코드 블록이 좋습니까?
이 항목이 유용합니까?
자세한 의견
인사말
x
온라인 MSDN을 향상시키는 데 도움이 되는 의견을 보내 주셔서 감사합니다.
사용자 의견
보기 전환
기본
Lightweight
ScriptFree
보기 전환