Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista Tutorial - Search Registry value and change value data

Reply
 
Old 08-01-2008   #1 (permalink)
AlejandroArias
Guest


 
 

Search Registry value and change value data

Hi,

I need a big help.... I need a script to

Search all the registry for a value for ex: sTimeFormat and change its
value data, for ex, h:m:ss by hh:mm:ss

The sTimeFormat value may be several times in all registry...

can you help me please?

My System SpecsSystem Spec
Old 08-01-2008   #2 (permalink)
mayayana
Guest


 
 

Re: Search Registry value and change value data

That's a big job. You probably want to use the
StdRegProv object from WMI. If you don't know
about that then look it up on Google. StdRegProv
provides a set of functions you can use. There's
EnumKey and EnumValues that you can use to read
the Registry. You'll need to use those in a recursive
routine. You can then use SetStringValue to make
the changes.

VBScript has easier methods in the WScript.Shell
object (RegRead, RegWrite) but there are no enumeration
functions there, so you need StdRegProv. Also, WMI must
be installed, and the WMI service be running, in order to
use StdRegProv.
Quote:

>
> I need a big help.... I need a script to
>
> Search all the registry for a value for ex: sTimeFormat and change its
> value data, for ex, h:m:ss by hh:mm:ss
>
> The sTimeFormat value may be several times in all registry...
>
> can you help me please?

My System SpecsSystem Spec
Old 08-02-2008   #3 (permalink)
AlejandroArias
Guest


 
 

Re: Search Registry value and change value data

Solved:

I found this
http://www.billsway.com/vbspage/Show...es/RegSrch.txt

And modify ->

Option Explicit
Dim oWS : Set oWS = CreateObject("WScript.Shell")
Dim oFSO : Set oFSO = CreateObject("Scripting.FileSystemObject")

Dim sSearchFor
sSearchFor = "sThousand"

Dim sRegTmp, sOutTmp, eRegLine, sRegKey, aRegFileLines

sRegTmp = oWS.Environment("Process")("Temp") & "\RegTmp.tmp "
sOutTmp = "test.txt"

oWS.Run "regedit /e /a " & sRegTmp, , True '/a enables export as Ansi
for WinXP

With oFSO.GetFile(sRegTmp)
aRegFileLines = Split(.OpenAsTextStream(1, 0).Read(.Size), vbcrlf)
End With

oFSO.DeleteFile(sRegTmp)

For Each eRegLine in aRegFileLines
If InStr(1, eRegLine, "[", 1) > 0 Then sRegKey = eRegLine
If InStr(1, eRegLine, sSearchFor, 1) > 0 Then

sRegKey = Replace(sRegKey, "[", "")
sRegKey = Replace(sRegKey, "]", "")

oWS.RegWrite sRegKey & "\" & sSearchFor, "."

End If
Next

Erase aRegFileLines
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Registry Search Tool... Cleaning Up Vista Registry... Vista General
Add to DevicePath Data in registry .NET General
Registry and data types PowerShell
could not update registry data? Vista General
could not update registry data? Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46