Jump to content

Replace string in registry value


Go to solution Solved by mikell,

Recommended Posts

Hi,

I have a large registry value that contain the next string:

<audioSettings><deviceId>Realtek Digital Input (Realtek </deviceId>

The string "Realtek Digital Input (Realtek" can be "Microphone (SB Audigy)" or else.

I want to change "Realtek Digital Input (Realtek" or whatever is between <audioSettings><deviceId>  and </deviceId> with "NO_MIC", to look finally like this:

<audioSettings><deviceId>NO_MIC</deviceId>

How should look the StringRegExpReplace command?

Link to comment
Share on other sites

Thanks!

The script should look like this:

$string = RegRead("HKEY_CURRENT_USER\Software\TechSmith\Camtasia Studio\8.0\Camtasia Recorder\8.0", "RecorderConfig")
$replace = "NO_MIC"
$new_string = StringRegExpReplace($string, '(?<=<deviceId>)([^<]+)', $replace)
RegWrite("HKEY_CURRENT_USER\Software\TechSmith\Camtasia Studio\8.0\Camtasia Recorder\8.0", "RecorderConfig", "REG_SZ", $new_string)
Edited by ffdshow
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...