<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-NZ link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Don’t quote FW_Path element of the program path – you need to quote the <u>entire</u> path AND program file name when/if any <u>part</u> of the path or the filename itself does – or may – contain spaces:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>e.g. “path a\sub a\sub b\prog.exe”<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><u><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>not</span></u><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> “path a”\sub\prog.exe<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>So in your case, this should do the trick:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:#00002B'> FW_Path := X; <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:#00002B'> DXF := openDialog1.FileName; <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:#00002B'> ProgramName := ‘”’ + FW_Path + '\FWTools2.4.7\bin\ogr2ogr” "-f" "PostgreSQL" PG:"host=192........ user=postgres dbname=E5R password=........" "'+ DXF +'" -nln Import_Process';<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:#00002B'> ShowMessage(ProgramName);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>hth<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> delphi-bounces@delphi.org.nz [mailto:delphi-bounces@delphi.org.nz] <b>On Behalf Of </b>Bob Pawley<br><b>Sent:</b> Thursday, 23 June 2011 10:30<br><b>To:</b> DUG<br><b>Subject:</b> [DUG] Variable in String<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><div><div><p class=MsoNormal><span style='color:#00002B'>Hi<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:#00002B'> <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:#00002B'>I’m having trouble with using a variable in a string path.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:#00002B'> <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:#00002B'>When I use the variable FW_Path := ‘C:\Program Files (x86)’ with two single quotes, the following works well and ShowMessage(ProgramName); displayed the full path .<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:#00002B'> <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:#00002B'>When I reference FW_Path to a variable X I get an error returned “Can Not run....” The variable X is returned as C:\Program Files (x86) without quotes. <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:#00002B'> <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:#00002B'>I attempted Quote String and got the following ‘C:\Program Files (x86) with one single quote.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:#00002B'> <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:#00002B'>Both cases return the same error - and in both cases ShowMessage(ProgramName); displayed none of the path after C:\Program Files (x86).<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:#00002B'> <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:#00002B'>Help would be appreciated.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:#00002B'> <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:#00002B'>Bob<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:#00002B'> <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:#00002B'> FW_Path := QuoteStr(X); <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:#00002B'> DXF := openDialog1.FileName; <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:#00002B'> ProgramName :=FW_Path+'\FWTools2.4.7\bin\ogr2ogr "-f" "PostgreSQL" PG:"host=192........ user=postgres dbname=E5R password=........" "'+ DXF +'" -nln Import_Process';<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:#00002B'> ShowMessage(ProgramName);<o:p></o:p></span></p></div></div></div></div></body></html>