Page 1 of 1

Quotes problem

Posted: 15 Aug 2007 15:11
by miraqi
Hi, I am troubled with this problem, please help.

let s assume the batch file called cityear.bat contains the following:


:::start of file
@ECHO OFF

SET cn=Nabeul

FOR %%Y IN (0203 0304 0405 0506) DO (
ECHO "define !ville () '%cn%' !enddefine."> cityear_%%Y.sps
ECHO "define !annee () '%%Y' !endefine. " >> cityear_%%Y.sps
ECHO "define !sannee () %%Y !enddefine." >>cityear_%%Y.sps
)

SET cn=

:::END of file
----------------------

After this I get 4 files:
cityear_0203.sps
cityear_0304.sps
cityear_0405.sps
cityear_0506.sps

each one contains (for example cityear_0203.sps):
"define !ville () 'Nabeul' !enddefine."
"define !annee () '0203' !endefine. "
"define !sannee () 0203 !enddefine."
----------------------------------------------
the question is I want the same output WITHOUT THE DOUBLE QUOTES("):
define !ville () 'Nabeul' !enddefine.
define !annee () '0203' !endefine.
define !sannee () 0203 !enddefine.



Please if you know how to do it directly from the cityear.bat file inside the for loop, let me know, OR also if you know a way to scan the output files and remove the double quotes...All is fine...THanks a lot

Posted: 30 Aug 2007 08:24
by jeb
Hi,

instead of using
ECHO "define !ville () '%cn%' !enddefine."> cityear_%%Y.sps

try this

ECHO define !ville ^(^) '%cn%' !enddefine.> cityear_%%Y.sps

Hope it helps
jeb

Posted: 30 Jun 2008 04:08
by Thebetr1
just strip the quotes out, easy...

set var=%var:'=%

or for double...

set var=%var:"=%

easy!