Saved Bookmarks
| 1. |
Solve : Remove/replace characters in strings (command line/batch)? |
|
Answer» SET variable=%variable:old string=new string% example set string=BACON and eggs to replace bacon with ham: set string=%string:bacon=ham% (ie delete bacon and replace with ham) %string% is now: ham and eggs to REMOVE a character wherever it occurs set string=abracadabra set string=%string:a=% (ie delete a and replace with NOTHING) %string% is now: brcdbr You can use a new variable or reuse the old one set breakfast=SPAM spam spam and spam set lunch=%breakfast:spam=jerky% %lunch% is jerky jerky jerky and jerky |
|