Search notes:

cmd.exe: Replacing parts of a variable value

In cmd.exe, a part of a variable can be replaced with a different value with the %VARNAME:search=replace% construct:
@echo off

setlocal

rem
rem  Note the typo
rem
set VAR=Hello wrold.

rem
rem print the variable and fix the
rem typo in one go:
rem
echo %VAR:wrold=world%

endlocal
Github repository about-cmd.exe, path: /variables/colon/replace.bat

See also

Variables

Index