Using VBS to modify system registry 
Author Message
 Using VBS to modify system registry

Hi,
      Can somebody show me samples of using VBS to modify system registry?

Thanks in advance
Brian



Sat, 01 Feb 2003 03:00:00 GMT  
 Using VBS to modify system registry
Brian,

Look up the WScript.Shell methods RegRead(), RegWrite() and RegDelete(). But
since there's no way enumerate the subkeys or the values for a given
registry key, it's not possible to "walk" the registry with these methods
(yes, I know you can do it with shell.Run("REGEDIT.EXE /E C:\\Temp\\temp.reg
...") and OpenTextFile("C:\\Temp\\temp.reg") followed by reading and
analysing the file, but that's far too complicated for the common scripting
client).

But maybe reading, writing and deleting keys and values will be enough for
the modifications you plan.

The following sample reads the "Personal" user shell folder from the
registry and launches Windows Explorer with the personal folder as the
current folder:

    var shell = WScript.CreateObject("WScript.Shell");
    var personal_folder =
shell.RegRead("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\"+

"CurrentVersion\\Explorer\\User Shell Folders\\Personal");
    personal_folder = shell.ExpandEnvironmentStrings(personal_folder);    //
might contain variable references
    shell.Run("explorer.exe /n,/e," + personal_folder, 1, true);

HTH, W.



Quote:
>       Can somebody show me samples of using VBS to modify system registry?



Mon, 03 Feb 2003 03:00:00 GMT  
 Using VBS to modify system registry

You can enumerate keys with RegObj.dll... You can find this on my site in the downloads section...
--
Clarence

Win32Scripting....
No, not that other one..... THE ORIGINAL...
http://cwashington.netreach.net

On THIS site you will find everything you need to get up and running. A script repository with over 400 FREE sample scripts, a downloads section with FREE COM objects for scripting, a library of reference materials and an online discussion lounge to provide community based technical support. Check it out.

Quote:

> Brian,

> Look up the WScript.Shell methods RegRead(), RegWrite() and RegDelete(). But
> since there's no way enumerate the subkeys or the values for a given
> registry key, it's not possible to "walk" the registry with these methods
> (yes, I know you can do it with shell.Run("REGEDIT.EXE /E C:\\Temp\\temp.reg
> ...") and OpenTextFile("C:\\Temp\\temp.reg") followed by reading and
> analysing the file, but that's far too complicated for the common scripting
> client).

> But maybe reading, writing and deleting keys and values will be enough for
> the modifications you plan.

> The following sample reads the "Personal" user shell folder from the
> registry and launches Windows Explorer with the personal folder as the
> current folder:

>     var shell = WScript.CreateObject("WScript.Shell");
>     var personal_folder =
> shell.RegRead("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\"+

> "CurrentVersion\\Explorer\\User Shell Folders\\Personal");
>     personal_folder = shell.ExpandEnvironmentStrings(personal_folder);    //
> might contain variable references
>     shell.Run("explorer.exe /n,/e," + personal_folder, 1, true);

> HTH, W.



> >       Can somebody show me samples of using VBS to modify system registry?



Mon, 03 Feb 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Modifying windows 2000 user accounts using VBS

2. return codes from .vbs scripts called from C using system()

3. How to write the binary values to the registry using vbs

4. Start VBS by VBS on another System

5. Modifying the system date with VBScript

6. Modifying System Servicies on NT 4

7. Modify registry doesn't take effect

8. Creating a script to modify a HKEY_LOCAL_MACHINE variable in windows registry (98/95)

9. Modify registry key with UNC'name

10. Modifying Registry settings - Newbie question

11. Modify registry

12. How to modify a binary value in registry ?

 

 
Powered by phpBB® Forum Software