I have tried this and it isn't working...:
@echo off
echo seting up session...
setLocal EnableDelayedExpansion
type command1.txt > session.html
for /f "tokens=* delims= " %%a in (command2.txt) do (
set /a N+=1
set v[!N!]=%%a
)
set line1=%v[1]%
echo %line1%
endlocal
)
REM -- Prepare the Command Processor --
SETLOCAL ENABLEEXTENSIONS
SETLOCAL DISABLEDELAYEDEXPANSION
::BatchSubstitude - parses a File line by line and replaces a substring"
::syntax: BatchSubstitude.bat OldStr NewStr File
:: OldStr [in] - string to be replaced
:: NewStr [in] - string to replace with
:: File [in] - file to be parsed
if "%~1"=="" findstr "^::" "%~f0"&GOTO:EOF
for /f "tokens=1,* delims=]" %%A in ('"type %3|find /n /v """') do (
set "line=%%B"
if defined line (
call set "line=echo.%%line:%~1=%~2%%"
for /f "delims=" %%X in ('"echo."%%line%%""') do %%~X
) ELSE echo.
)
start session.html
echo done! Enjoy!
pause
What I am trying to do is:
<p><b>This is a Simulated Media Rendering Session
<br></br></b>Made by MicroTech</p><br></br>Visit us @ mtcomputers.weebly.com<br> </br>and find SMRS Info @ mtsmrs.weeby.com<br></br>Have fun on the internet!<br></br>Here is Yor Media:</p>
<iframe width="420" height="345"
src="http://www.youtube.com/embed/code"
</iframe>
<p>
http://www.mtcopmuters.weebly.com
</p>
See that scr="http:/.... Thing? I need to change "code" in that line to a variable from a text file (managed above). But the question is: I need to set a variable in my batch file that is equal to the text in command2.txt (already done), then I need to change the word "code" in the above html snippet to whatever is assigned to that variable. On Any answers please describe where I put the file names and everything etc.... Thanks! Have a good day!