String replacement in batch file

Posted by Faisal on Stack Overflow See other posts from Stack Overflow or by Faisal
Published on 2010-05-05T10:43:23Z Indexed on 2010/05/05 10:58 UTC
Read the original article Hit count: 321

Filed under:
|

We can replace strings in a batch file using the following command

set str="jump over the chair"
set str=%str:chair=table%

These lines work fine and change the string "jump over the chair" to "jump over the table". Now I want to replace the word "chair" in the string with some variable and I don't know how to do it.

set word=table
set str="jump over the chair"
??

Any ideas?

© Stack Overflow or respective owner

Related posts about batch-file

Related posts about command-line