Guest alastair.cameron Posted January 20, 2004 Share Posted January 20, 2004 I have an INI file which contains key values with embedded double quotes. The key values are command lines which may contain parameters which are long filenames (and hence have double quotes around them). When I use IniRead to read a value, if the value has a double quote at the beginning of the key value, the quotes are stripped from the beginning/end of the key value. If the key value begins or ends with another character, everything seems OK. Is this a bug? Example ---------- Test.ini. Section name [install]. Using the command: $g_InstallCmdLine = IniRead($g_iniConfigFilename, "Install", "InstallCmdLine", "") $g_InstallCmdLine looses the " at the beginning and end of the value. [install] InstallCmdLine="E:\DIW 8.0\CD-ROM\setup.exe" /s /f1"E:\Vss\DevKingston\BuildManager\Automated Test\install.iss" /f2"E:\Vss\DevKingston\BuildManager\Automated Test\silent_install.log" /verbose"E:\Vss\DevKingston\BuildManager\Automated Test\verbose_install.log" Link to comment Share on other sites More sharing options...
trids Posted January 21, 2004 Share Posted January 21, 2004 (edited) The pure syntax for INI files requires you to quote the values, and omitting the outer quotes is just shorthand. So what you're noticing is not a bug ... but a feature! (seriously ). See, you may want to specify a parameter with spaces on the ends: suppose you want to pass in the word fred with a trailing space. This is actually "fred " (ignoring the quotes. That's what INI files do too .. they ignore the outer quotes, if there is a pair. All you need is to wrap your value in another set of quotes .. which INI file processing will strip, leaving the ones you want intact. Experiment with the following INI file (for illustration, read # as a space): [Install] Parm1=fred Parm2="fred" Parm3=fred### Parm4="fred###" Parm5="fred Parm6=""fred Parm7=""fred" Assuming you read each value into $sX, display it with msgbox (0,"","|" & $sX & "|") Edited January 21, 2004 by trids Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now