Jump to content

RegRead and remove filename


eJan
 Share

Recommended Posts

I need help to use clean path or to remove filename from Registry value.

RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\BWMeter", "UninstallString")

In my case "UninstallString" is: C:\Program Files\BWMeter\Uninstall.exe
Link to comment
Share on other sites

Uhm.. RegDelete?

No, because I'd like to use for other scripts, I need string to count chars until "\" or "\*2", and use converted string without filename for updates.

*Edit

Not to modify the Registry.

Edited by eJan
Link to comment
Share on other sites

Wait... so you want to just pull the bolded part of the text from the RegRead?

Use StringInStr.

Offhand (not looking at the manual), I think it goes something like this:

$string = RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\BWMeter", "UninstallString")
$pos = StringInStr($string, '\', 0, -1)
$newstring = StringLeft($string, $pos)
msgbox(0, 'get path', $string & '=>' & $newstring)

My memory for syntax isn't perfect though.

Link to comment
Share on other sites

Wait... so you want to just pull the bolded part of the text from the RegRead?

Use StringInStr.

Offhand (not looking at the manual), I think it goes something like this:

CODE$string = RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\BWMeter", "UninstallString")

$pos = StringInStr($string, '\', 0, -1)

$newstring = StringLeft($string, $pos)

msgbox(0, 'get path', $string & '=>' & $newstring)

My memory for syntax isn't perfect though.

Works great, thanks Saunders!
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...