Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 417
domlao Avatar asked Apr 26 '26 17:04

domlao


2 Answers

set a="hello" world
set b=%a:"=%
like image 100
cure Avatar answered Apr 28 '26 10:04

cure


correct syntax:

set "tempvar="/path/compile" -o source.cpp"
echo %tempvar%
set "tempvar=%tempvar:"=%"
echo %tempvar%
like image 30
Endoro Avatar answered Apr 28 '26 11:04

Endoro