JavaScript client registry

Source: Internet
Author: User

// Generate a wscript. Shell object that can operate the registry and execute command lines.

VaR OBJ = new activexobject ("wscript. Shell ");

// Read the value of testvalue from the explorer table entry

VaR testvalue = obj. regread ("HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Policies \ Explorer \ testvalue ");

// Write a new key to the explorer table entry: testvalue; Value: 1; Type: REG_SZ

OBJ. regwrite ("HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Policies \ Explorer \ testvalue", "1", "REG_SZ ");

// Write a new table entry to the explorer table entry: testvalue. The default value is null and the type is REG_SZ.

OBJ. regwrite ("HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Policies \ Explorer \ testvalue \", "", "REG_SZ ");

// Delete the key named testvalue In the explorer table

OBJ. regdelete ("HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Policies \ Explorer \ testvalue ");

// Delete the table item testvalue and its subkeys In the explorer table item

Obj. RegDelete ("HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Policies \ Explorer \ TestValue \\");

We can see that when you use WScript. Shell to operate the registry, "\" is used to distinguish whether the operation object is a table item or a key.

Using this method to operate the client registry requires that the client's browser security settings allow "Running unsigned ActiveX scripts", otherwise it will not work. This is obvious, or the virus will flood.

 

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.