Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to implement Registry Operation by vbs

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Editor to share with you how to achieve the registry operation of vbs, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to understand it!

1. Read the keywords and values of the registry:

You can pass the full path of the keyword to the regread method of the wshshell object. For example:

The copy code is as follows:

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:

The copy code is as follows:

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 key value of HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\ Windows\ CurrentVersion\ Run\ jj was changed to hello. Note, however: this key value must exist in advance.

If you want to create a new keyword, use this method as well.

The copy code is as follows:

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

Using the regdelete method, just pass the complete path to regdelete

For example

Val=ws.regdel (path)

Note that if you want to delete the value of the keyword, be sure to 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 point of view, it might be better to use WMI's registry processing function.

The above is all the contents of the article "how to operate the registry in vbs". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report