Quotes problem

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
miraqi
Posts: 1
Joined: 15 Aug 2007 15:02

Quotes problem

#1 Post by miraqi » 15 Aug 2007 15:11

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

jeb
Expert
Posts: 951
Joined: 30 Aug 2007 08:05
Location: Germany, Bochum

#2 Post by jeb » 30 Aug 2007 08:24

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

Thebetr1
Posts: 12
Joined: 30 Jun 2008 02:50
Location: My computer
Contact:

#3 Post by Thebetr1 » 30 Jun 2008 04:08

just strip the quotes out, easy...

set var=%var:'=%

or for double...

set var=%var:"=%

easy!

Post Reply