I want to replace "mod" in string with "%":set string=%string:mod=x%
What I should input as "x"?
you can do that by enabling delayed expansion so you can use !
as delimiters. Then, doubling the percent sign allows to represent percent as a replacement char.
@echo off
setlocal enabledelayedexpansion
set string=12 mod 15
set string=!string:mod=%%!
echo %string%
result
12 % 15
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With