Sign in to follow this  
Followers 0
eJan

RegRead and remove filename

5 posts in this topic

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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
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.

Share this post


Link to post
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!

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  
Followers 0