Base de connaissance
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.
Le Deal du moment :
Funko POP! Jumbo One Piece Kaido Dragon Form : ...
Voir le deal

Write, Read & Delete from registry

Aller en bas

Write, Read & Delete from registry Empty Write, Read & Delete from registry

Message  Admin Mer 15 Avr - 11:31

The RegRead method reads and returns a registry key or value named by strName. If strName ends with a backslash (\), then RegRead returns a key. Otherwise it returns a value. The strName parameter must begin with one of the following root key names:
HKEY_CURRENT_USER or HKCU
HKEY_LOCAL_MACHINE or HKLM
HKEY_CLASSES_ROOT or HKCR
HKEY_USERS
HKEY_CURRENT_CONFIG
The following VBScript code writes a key/value pair into the registry, reads and displays their content, and finally removes them from the registry.

Code:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegWrite "HKCU\MyNewKey\", 1 ,"REG_DWORD"
WshShell.RegWrite "HKCU\MyNewKey\MyValue", "Hello world!"

WScript.Echo WshShell.RegRead("HKCU\MyNewKey\MyValue")
WScript.Echo WshShell.RegRead("HKCU\MyNewKey\")

WshShell.RegDelete "HKCU\MyNewKey\MyValue"
WshShell.RegDelete "HKCU\MyNewKey\"

Output:
Hello World!
1

Admin
Admin

Nombre de messages : 45
Date d'inscription : 20/01/2009

http://programming.formyjob.net

Revenir en haut Aller en bas

Revenir en haut

- Sujets similaires

 
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum