I'm looking to create a bat file that when ran, will prompt the user for a simple value. That value is then used to edit a source file where it will replace a generic value and then save the file as a new file. I've got the file creation part done, but I'm having an issue with the prompt as the new file just has a blank value.
This is what I have so far:
@echo off
set "replace=CHANGE-ME"
set /p new_variable="replaced"
set "source=download.volt"
set "target=download.shtml"
setlocal enableDelayedExpansion
(
for /F "tokens=1* delims=:" %%a in ('findstr /N "^" %source%') do (
set "line=%%b"
if defined line set "line=!line:%replace%=%new_variable%!"
echo(!line!
)
) > %target%
endlocal
I think my syntax is close but I'm not sure where I'm off.
Thanks!