Solved Not able to pass this argument to set table_start=^table

November 8, 2014 at 14:19:40
Specs: Windows 7
I want to add gif files into a TABLE (HTML file) by using batch command, I am facing problem in below line
set "table_start=^<table border="1">"

not able to set the border for the table, below is the complete code

@echo off
setlocal

set "file_start=^<title^>^HTML Table Header GIRI^</title^>"
set "table_start=^<table border="1">"
set "image_start=^<tr^>^<th^>^<IMG SRC=""
set ^"image_end="^>^</th^>^<th^>^Remarks^</th^>^</tr^>"
set "table_end=^</table^>"
set "file_end=^</BODY^>^</HTML^>"
set "file_name=Index.html"


>"%file_name%" ( echo %DATE% %TIME%
echo %file_start%
for %%I in (*.gif) do echo %image_start%%%~fI%image_end%

echo %file_end%
)

start %file_name%

Can someone help me on this?
Thank YOu


See More: Not able to pass this argument to set table_start=^table

Report •


#1
November 8, 2014 at 19:10:16
I don't get what's up with all the dbl quotes. Seems to me you need to lose the outside ones, and I recommended to use single quotes for the HTML:
from:
set "file_start=^<title^>^HTML Table Header GIRI^</title^>"
set "table_start=^<table border="1">"
to something like:
set file_start=^<title^>^HTML Table Header GIRI^</title^>
set table_start=^<table border='1'>

Report •

#2
November 8, 2014 at 21:55:52
I tried but by doing the changes you suggested but i got a error
"The syntax of the command is incorrect"

Report •

#3
November 9, 2014 at 19:19:31
✔ Best Answer
First, you're missing an escape at end of this line:
set table_start=^<table border='1'>
should be:
set table_start=^<table border='1'^>
next, extra escape, needs removed in this line:
set file_start=^<title^>^HTML Table Header GIRI^</title^>
should be:
set file_start=^<title^>HTML Table Header GIRI^</title^>

After you fix those, do a global replace of all carrots '^', with three: '^^^'. Then it should work (at least, it did in my tests)

Also, you forgot to plug %table_start/end% into the html. Here's what mine looked like after the above mods:
@echo off
setlocal

set file_start=^^^<title^^^>HTML Table Header GIRI^^^</title^^^>
set table_start=^^^<table border='1'^^^>
set image_start=^^^<tr^^^>^^^<th^^^>^^^<IMG SRC=
set ^^^image_end=^^^>^^^</th^^^>^^^<th^^^>^^^Remarks^^^</th^^^>^^^</tr^^^>
set table_end=^^^</table^^^>
set file_end=^^^</BODY^^^>^^^</HTML^^^>
set file_name=Index.html

>%file_name% ( echo %DATE% %TIME%
echo %file_start%
echo %table_start%
for %%I in (*.gif) do echo %image_start%%%~fI%image_end%

echo %table_end%
echo %file_end%
)

start %file_name%

as a final note, you can echo directly (as opposed to using variables) with only one carat: >test echo ^<html^>

message edited by nbrane


Report •
Related Solutions


Ask Question