Escaping an equals sign in DOS batch string replacement command

后端 未结 4 2250
隐瞒了意图╮
隐瞒了意图╮ 2021-01-15 11:20

I need to replace some text in a JNLP file using a DOS batch file to tune it for the local machine.

The problem is that the search pattern contains an equals sign wh

4条回答
  •  不思量自难忘°
    2021-01-15 11:40

    One cannot simply replace (a substring with) an equal-sign, without splitting up (for-statement with "delims==") or trimming…

    But perhaps you could go for this simpler but more confusing approach, using the following statement in your for-loop:

    set str=!str:"100M" max-heap-size="%min%M" max-heap-size!
    

    It just combines the string to replace with what comes after instead of what comes before, avoiding any equal-sign replacements entirely.

提交回复
热议问题