I'm trying to replace a string in a text file, but the string has the greater sign.
original.txt file:
Code: Select all
url = "http://myurl/<API_KEY>/xx"
Code: Select all
set var=12345678
For /f "tokens=* delims=/" %%a in (original.txt) do (
Set str=%%a
set str=!str:<API_KEY>=%var%!
echo !str! >>out.txt
)
Code: Select all
INFO.BAT version 1.4
--------------------------------------------------------------------------------
Windows version : Microsoft Windows [versão 10.0.10586]
Product name : Windows 10 Pro, 64 bit
Performance indicators : Processor Cores: 4 Visible RAM: 16686620 kilobytes
Date/Time format : (dd/mm/yy) 23/02/2018 11:57:33,37
__APPDIR__ : C:\Windows\System32\
ComSpec : C:\WINDOWS\system32\cmd.exe
PathExt : .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
Extensions : system: Enabled user: Enabled
Delayed expansion : system: Disabled user: Disabled
Locale name : pt-BR Code Pages: OEM 850 ANSI 1252
DIR format : 23/02/2018 09:27 7.103.500.288 pagefile.sys
Permissions : Elevated Admin=No, Admin group=Yes
User AutoRun found : AutoRun REG_SZ "C:\PROGRA~2\clink\043213~1.9\clink.bat" inject --autorun
Missing from the tool collection: debug