◎ Vbs Script Programming Tutorial 6-Modify the Registry

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.