Read quote in ini file.
Keywords: Read quotes ini file inireadpvt
Question:
I am having difficulty with IniReadPvt(...) reading embedded quotes and spaces in an ini file.For example my ini file reads as follows....
[MAIN]
keyword=" hello "
I want to read " hello " from the file, but it seems to be removing the quotes and the spaces....
Any ideas?
Answer:
Ok, here is the issue. The iniReadPvt is going to recognize the quotes. Quotes are ignored by ini file operations. But it does *see* the spaces.Depending on your needs
------------------------
You could try this.....
dastring=IniReadPvt (section, keyname, default, filename) message("Length of string (Notice it does see the spaces)",strlen(dastring)) ;concatenate quotes onto the string dastring=strcat('"',dastring,'"') message("resulting string",dastring) exit*OR*
You could use a character in the ini file to stand in place of quotes, then convert them to quotes once read into winbatch....
NOTE: The character you use in the ini file cannot possibly match any other character in the ini file....
INI file
[MAIN] Keyword=#$ item #$WBT file
dastring=IniReadPvt (section, keyname, default, filename) ;Replace #$ with " dastring=StrReplace(dastring, '#$', '"') message("resulting string",dastring) exit
Article ID: W14610Filename: Read quote in ini file.txt