I am trying to replace all instances of a character in a string of text with another character but I’m not succeeding.
Suppose the text is
cat rat mat fat
I want the script to replace all the t's to p's
cap rap map fap
What I have is the following but it seems to do little for me.
SET /P MY_TEXT=ENTER TEXT:
SET T2P=P
SET NEW_TEXT=%TEXT=:T!T2P!%
MSG * %NEW_TEXT%
You’ve got the
=sign in the wrong place. Try:You can also do the expansion the other way round, i.e.