Need to remove quotes in a line

Microsoft Windows xp professional w/serv...
July 14, 2010 at 11:28:28
Specs: Windows server 2008
Hi,

I have the string stored in variable 1 as :

test1 = "My Test string"

My requirement is to store the string in some
other variable without quotes.
Please let me know how to achieve the same
using batch script.

Desired output :

test 2 = My Test String (without quotes)


See More: Need to remove quotes in a line

Report •

#1
July 14, 2010 at 11:42:11
@echo off & setLocal EnableDELAYedeXpansion

set v1=test1 ^= "My Test string"
echo.!v1!
set v2=!v1:"=!
echo.!v2!


=====================================
Helping others achieve escape felicity

M2


Report •

#2
July 14, 2010 at 11:57:15
Hi,

Thanks for the response.
Since i am new to batch programming, I am not able to
understand the code.

This code is working fine but my exact requirement is to store
the string without quotes in some other variable say test2.

I have to pass this second varible to some other
program.Please suggest.


Report •

#3
July 14, 2010 at 12:04:07
This sets v1 with the quotes and v2 without them.

============================
@echo off & setLocal EnableDELAYedeXpansion

set v1=test1 ^= "My Test string"
echo v1 is set to !v1!
set v2=!v1:"=!
echo v2 is set to !v2!


=====================================
Helping others achieve escape felicity

M2


Report •

Related Solutions

#4
July 14, 2010 at 12:04:37
I have to pass the string without quotes in some other command
with syntax as %test2%.

That is why i want to first covert the string from

set test1 = "This is test" to test2 = This is test.

and pass the value of test 2 in some third party command (using
%test2)


Report •

#5
July 14, 2010 at 12:15:19
Hi,

I am trying to get the value of v2 using %v2% but instead of
giving me a string without quotes, its giving the output as :

Modified code:

@echo off & setLocal EnableDELAYedeXpansion
set v1=test1 ^= "My Test string"
echo v1 is set to !v1!
set v2=!v1:"=!
echo v2 is set to !v2!
echo %v2%
pause

Output
v1 is set to test1 = "My Test string"
v2 is set to test1 = My Test string
test1 = My Test string
Press any key to continue . . .


Report •

#6
July 14, 2010 at 12:30:19
U r genious man....Thanks for help...It's working fine..

Report •

Ask Question