Jump to content
Sign in to follow this  

Replace string in registry value

Recommended Posts


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:


How should look the StringRegExpReplace command?

Share this post

Link to post
Share on other sites


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

Share this post

Link to post
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
Sign in to follow this  

  • Create New...