WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Functions

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

ParseData Removes Quotes

Keywords: parsedata   

Question:

ParseData behaves strangely with the double-quotes. I receive from the registry the following string:
C:\Win95\uninst.exe -f"C:\Program Files\blahblah\DelsL1.isu"
After ParseData, I find the following:
PARAM1 is C:\Win95\uninst.exe
PARAM2 is -fC:\Program Files\blahblah\DelsL1.isu
the double-quotes in PARAM2 have disappeared. Because there is a space in the directory name, I have some problem using the data.

Even if I replace the double-quote (") with a single-quote (') or with a back-quote (`), the ParseData destroys it. Replacing the double-quote by anything which is not a string delimiter leaded to "unpredictable results". Do you have a workaround for this kind of problem ??

Answer:

After getting the string from the registry, you are going to have to pick it apart very carefully. Perhaps avoid parsedata.

I don't think you can make a general solution the the problem, but you should be able to solve this problem.

Basically you use the strscan function to look for a doublequote OR a space. When it finds a character, look at the character.

; you'll need to set up the exact syntax in this example.  This is just the general logic.

param0=0
start=1
while 1
finish=strscan for " or space	  
if finish==0 then break
if char at a is "
    finish=strscan for "
    if finish==0 then break
    continue
endif
param0=param0+1
param%param0% = strsub(line,start,finish)
endwhile

Article ID:   W13098
Filename:   ParseData Removes Quotes.txt
File Created: 1999:04:15:16:51:44
Last Updated: 1999:04:15:16:51:44