Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

WScript registry function

Posted on 2006-06-20
5
Medium Priority
?
748 Views
Last Modified: 2008-02-01

can someone explain me rather than just giving an example the following wscript functions:

write value to registry (a string)
delete value from registry (also a string)
0
Comment
Question by:Mark_FreeSoftware
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 30

Assisted Solution

by:nmcdermaid
nmcdermaid earned 600 total points
ID: 16948006
Do you mean the RegRead and RegDelete methods of the WshShell object?

They simpy read or delete values in the registry.


Do you know what the registry is? its basically a heirarchial data store.


If you press start then run, and type 'regedit' then you can look inside it.


RegRead simply reads an item of data from a location.

RegDelete will delete a registry key (assuming you have rights to do so)


0
 
LVL 13

Author Comment

by:Mark_FreeSoftware
ID: 16951366
i do know what the registry is, i did edit it with api, but i was pointed to this code:

and i want some more explanation about the wshshell registry method

   Dim WSHShell
   Set WSHShell = CreateObject("WScript.Shell")
   WSHShell.RegWrite "HKLM\SOFTWARE\example", "test"
   WSHShell.RegWrite "HKLM\SOFTWARE\example\", "test2"
   WSHShell.RegDelete "HKLM\SOFTWARE\example\"


for example, what is the difference between the lines 3 and 4 (test and test2)

what should i add for error cheching, and what are the pro's and cons of using wshshell
0
 
LVL 29

Accepted Solution

by:
nffvrxqgrcfqvvc earned 1400 total points
ID: 16955739
The advantage is that if you don't have VB installed it makes writing to the registry very simple plus other windows tasks, it can do more than just write to the registry you can run a file and so on. However these calls should only be used if your going to use .VBS file. But then you run the risk of an anti-virus program either blocking or deleting the .VBS file all together so the advantages are about zero unless you are an administrator and write some scripts to simply other personal tasks.

The disadvantage is that your depending on another process to be enabled on the machine (wscript.exe) basically when you call this from VB using createobject, vb is taking on the task of looking to make sure that the registry key exists for the CLSID. The worst case scenerio is if you implement this call using VB then you better make sure the user will have it Enabled and Installed on the system because they can easily uninstall it and if your program depends on writing values to the registry well of course they will never be written.
0
 
LVL 13

Author Comment

by:Mark_FreeSoftware
ID: 16955814

thanks for making that clear!

>>well of course they will never be written.

that's not nice :(


i will be watching this a few more days, but if there are no other (usefull) comments, i will split this question



mark
0
 
LVL 13

Author Comment

by:Mark_FreeSoftware
ID: 17003489

thanks both for your help and patience!
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question