Is there a way to apply :search=replace
-syntax to %%var
inside a for-loop in Batch?
I'm trying to replace all hyphens with colons inside the mac-addresses of a machine (and then use them). Unfortunately, my regular approach set var=%var:-=:%
does not work inside a for loop.
FOR /F "tokens=12 delims= " %%G IN ('ipconfig /all ^| find /I "Physical Address"') DO (
SET var=%%G
SET newmac=%var:-=:%
wget https://api-server-uri/pxe/do-stuff?newmac=%newmac%
)
The problem is that the value of %var:-=:%
does not change along with %%G
.
Thanks