home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch.nt      Fun with Windows NT batch files      68,980 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 67,337 of 68,980   
   JJ to Petr Laznovsky   
   Re: For /F loop and Non-latin UTF-8 char   
   29 Oct 18 17:03:16   
   
   From: jj4public@vfemail.net   
      
   On Wed, 24 Oct 2018 14:17:02 +0200, Petr Laznovsky wrote:   
      
   > Have FOR /F loop which perform sqlite DB query and process its output.   
   >   
   > for /f "tokens=*" %%a in ('echo %query% ^| %program%') do (echo %%a)   
   >   
   > where %query% is:   
   >   
   > SELECT icu_load_collation('cs_CZ', 'czech'); SELECT DISTINCT   
   > customers.pid,customers.fname,customers.lname,customers.stnum,   
   ustomers.flat_no,customers.city,customers.city_part,customers.ma   
   l,customers.tel,customers.status,customers.cust_type,customers.j   
   in_date,customers.leave_date,customers.fee,customers.varsym,   
   customers.note,customers.db_type,streets.st   
   > FROM customers,streets WHERE NOT customers.status BETWEEN 4 AND 4 AND   
   customers.cust_type BETWEEN 1   
   > AND 3 AND customers.lname LIKE '©%' AND streets.st_index = cus   
   omers.st_index ORDER BY lname;   
      
   That FOR command alone won't work because the ")" character in the %query%   
   variable is treated as the closing parethesis of the set enclosure for the   
   FOR command.   
      
   Unless the `echo %query%` command can be replaced with `echo "%query%"`, one   
   workaround is to move the commandline out of the FOR's set parameter and   
   redirect the output into a file. Then use TYPE for the FOR's set parameter.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca