knightEknight
asked on
replace = in a batch string
I'm looking for a quick way to do a string substitution of the '=' symbol.
In batch strings you can do simple search/replace like this:
set myvar=this=that
echo %myvar% - %myvar:t=T%
result: this=that - This=ThaT
But I'm looking for a simple way to replace the '=' symbol WITHOUT having to loop thru the string and re-build it.
Here's what I've tried:
echo %myvar:==X%
echo %myvar:^==X%
desired result: thisXthat
Any non-looping ideas? (or sourced confirmation that it can't be done?)
In batch strings you can do simple search/replace like this:
set myvar=this=that
echo %myvar% - %myvar:t=T%
result: this=that - This=ThaT
But I'm looking for a simple way to replace the '=' symbol WITHOUT having to loop thru the string and re-build it.
Here's what I've tried:
echo %myvar:==X%
echo %myvar:^==X%
desired result: thisXthat
Any non-looping ideas? (or sourced confirmation that it can't be done?)
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
yes, that is actually similar to what I'm doing now.
Thanks guys - it is good enough for me to know that the real answer is that there isn't one! :)
Thanks guys - it is good enough for me to know that the real answer is that there isn't one! :)
ASKER