domlao
domlao

Reputation: 16029

How to remove quotes in a variable in batch script

I have an issue in batch programming. I fetch the strings generated by consoles, then the string contains double quotes and I will save that to a variable, like,

"/path/compile" -o source.cpp

And now my problem is, how can I remove this 2 double quotes? I'm not sure how to remove that quotes in the middle of the string.

Please advise

Upvotes: 3

Views: 13636

Answers (2)

Endoro
Endoro

Reputation: 37589

correct syntax:

set "tempvar="/path/compile" -o source.cpp"
echo %tempvar%
set "tempvar=%tempvar:"=%"
echo %tempvar%

Upvotes: 5

cure
cure

Reputation: 2688

set a="hello" world
set b=%a:"=%

Upvotes: 10

Related Questions