The statements for modifying the Registry in vbs mainly include:
1. keywords and values for reading the registry:
You can pass the complete keyword path to the regread method of the wshshell object. For example:
Set Ws = wscript. Createobject ("wscript. Shell ")
V = ws. regread ("HKEY_LOCAL_MACHINE/software/Microsoft/Windows/CurrentVersion/run/nwiz ")
Wscript. Echo v
2. Write the Registry
Use the regwrite method of the wshshell object. Example:
Path = "HKEY_LOCAL_MACHINE/software/Microsoft/Windows/CurrentVersion/run /"
Set Ws = wscript. Createobject ("wscript. Shell ")
T = ws. regwrite (Path & "JJ", "hello ")
In this way
The HKEY_LOCAL_MACHINE/software/Microsoft/Windows/CurrentVersion/run/JJ key value is changed to hello. However, note that this key value must exist in advance.
This method is also used to create a new keyword.
Path = "HKEY_LOCAL_MACHINE/software/Microsoft/Windows/CurrentVersion/run/sssa2000/love /"
Set Ws = wscript. Createobject ("wscript. Shell ")
Val = ws. regwrite (path, "nenboy ")
Val = ws. regread (PATH)
Wscript. Echo Val
Delete keywords and values
Use the regdelete method to pass the complete path to regdelete.
For example
Val = ws. regdel (PATH)
Note: If you want to delete the keyword value, you must add "/" at the end of the path. If you do not add a slash, the entire keyword will be deleted.
Of course, from the current perspective, it may be better to use the WMI registry processing function.
This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/jinghaianlange/archive/2007/07/16/1693680.aspx