Adding quotes to a variable

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
mwilson58
Posts: 2
Joined: 30 Apr 2009 09:30

Adding quotes to a variable

#1 Post by mwilson58 » 30 Apr 2009 10:16

I have a variable that is passed to a .bat file within the bat file

SET MYVAR1=%1

db2 call myuser.myproc(%MYVAR1%)

What I need to do is wrap the variable is single quotes

i.e. DB needs to be 'DB'

Thank you in advance for your assistance

Marcus

mwilson58
Posts: 2
Joined: 30 Apr 2009 09:30

Never mind... figured it out

#2 Post by mwilson58 » 30 Apr 2009 10:41

Thanks

I just need to fight the dragon for a few more minutes.

trebor68
Posts: 146
Joined: 01 Jul 2011 08:47

Re: Adding quotes to a variable

#3 Post by trebor68 » 15 Sep 2011 02:15

You can do it with the first opportunity:

SET MYVAR1='%1'
db2 call myuser.myproc(%MYVAR1%)

or second opportunity:

SET MYVAR1=%1
db2 call myuser.myproc('%MYVAR1%')

If you want to start i.E. myuser.myproc('DB')

nitt
Posts: 218
Joined: 22 Apr 2011 02:43

Re: Adding quotes to a variable

#4 Post by nitt » 15 Sep 2011 19:07

mwilson58 wrote:I have a variable that is passed to a .bat file within the bat file

SET MYVAR1=%1

db2 call myuser.myproc(%MYVAR1%)

What I need to do is wrap the variable is single quotes

i.e. DB needs to be 'DB'

Thank you in advance for your assistance

Marcus


"db2"... "declare bytes 2"... What kind of Assembly-derived command is that?! Where you download?

Post Reply