/build/static/layout/Breadcrumb_cap_w.png

Need Help to create a VB script

Hi All,
I have to read a registry value and have to parse that value according to my requirement.

C:\Program Files\Software_name\quest\\setup.exe,0

I Have to parse the above string in such way that....it will see from Right side and when it will get "\\" it will return value from 1st char to the character before "\\"

can anybody tell me how to do that???

"C:\Program Files\Software_name\quest" this portion can be anything of any length.

0 Comments   [ + ] Show comments

Answers (5)

Posted by: pjgeutjens 13 years ago
Red Belt
0
Look at VBScript's Split function.

Btw, this post seems more suited for the scripting forum, a forum admin might move it.

PJ
Posted by: captain_planet 13 years ago
Black Belt
0
Yeah. Here's a quick example. The first example is what pj describes. The second example (I believe) is what you're describing.....but either would be fine.
Dim testvalue : testvalue = "C:\Program Files\Software_name\quest\\setup.exe,0"

Dim example1 : example1 = split(testvalue,"\\")(0)
Dim example2 : example2 = Left(testvalue, InStrRev(testvalue, "\\") - 1)

MsgBox example1
MsgBox example2
Posted by: pjgeutjens 13 years ago
Red Belt
0
captain,

small remark, won't the second example cause an error if the split string is not in the testvalue?
Since you'll effectively be calling
Dim example2 : example2 = Left(testvalue, 0 - 1)
PJ
Posted by: captain_planet 13 years ago
Black Belt
0
...with no suitable error handling, it sure will. [;)] Mind you, even if the split string didn't exist in the Split() example, it would still return an undesired result. So i guess my example assumes that the OP puts in his own error handling/other checks....
Posted by: anonymous_9363 13 years ago
Red Belt
0
No offence to anyone but look at the question: do you suppose the OP even knows HOW to add error-trapping?
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ