Izvozi (0) Natisni
Razširi vse
EN
Ta vsebina ni na voljo v vašem jeziku, vendar pa je tukaj angleška različica.
31 od 48 oseb je to ocenilo kot uporabno - Oceni to temo

RegDelete Method

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


                      object
                      .RegDelete(strName)
object

WshShell object.

strName

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

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

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:

Ali vam je bilo to v pomoč?
(Preostali znaki: 1500)
Zahvaljujemo se vam za povratne informacije

Vsebina skupnosti

Pokaži:
© 2014 Microsoft. Vse pravice pridržane.