As jeb explained in his answer, the batch parser converts 0x1A into a line feed, but the search and replace can be performed if variables are used. Here is an example of what jeb was talking about. I've embedded the string (in hex code) 0x1A 0x09 in the batch file. I use FOR /F with FINDSTR to get the value into a FOR variable. Everything after that is fairly straight forward.
@echo off
setlocal enableDelayedExpansion
:::→ :
for /f "delims=:" %%A in ('findstr "^:::" "%~f0"') do (
set "text=abc"%%A"def"
set text
set "text=!text:"%%A"=!"
set text
)
And here are the results:
text=abc"→ "def
text=abcdef
I did not include the quotes witin the embedded text because everything after the →
must be valid syntax. The tab and colon are harmless, but a quote would lead to a syntax error.
The behaviour of 0x1A behaving like a line feed can be useful. That is the mechanism I used to solve: Is it possible to embed and execute VBScript within a batch file without using a temporary file?