Not able to create tables by using batch cmd

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
giritime
Posts: 3
Joined: 08 Nov 2014 16:22

Not able to create tables by using batch cmd

#1 Post by giritime » 09 Nov 2014 00:18

I want to add gif files into a TABLE (HTML file) by using batch command, I am facing problem with below lines

set "table_start=^<table border='1'>"
set "table_one=^<tr^>^<th^>^Name^</th^>^<th^>^Remarks^</th^>^</tr^>"


when i edit the html file in notepad i don't see tags for table border and row one.
Below is the complete code, can somebody help me on this?

@echo off
setlocal

set "file_start=^<title^>^HTML Table Header GIRI^</title^>"
set "table_start=^<table border='1'>"
set "row_one=^<tr^>^<th^>^Name^</th^>^<th^>^Remarks^</th^>^</tr^>"
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 %USERNAME% %DATE% %TIME%
echo %file_start%
for %%I in (*.gif) do echo %image_start%%%~fI%image_end%

echo %file_end%
)

start %file_name%

ShadowThief
Expert
Posts: 1167
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Not able to create tables by using batch cmd

#2 Post by ShadowThief » 09 Nov 2014 07:59

It would probably help if you echoed %table_start% and %row_one% somewhere into the file.

Also, you need to escape the quotes in image_start and image_end by doubling them up, like "".

ShadowThief
Expert
Posts: 1167
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Not able to create tables by using batch cmd

#3 Post by ShadowThief » 09 Nov 2014 08:25

And since people here care about this, cross-posted on StackOverflow at http://stackoverflow.com/questions/2682 ... -batch-cmd (although for what it's worth, it was posted here first).

giritime
Posts: 3
Joined: 08 Nov 2014 16:22

Re: Not able to create tables by using batch cmd

#4 Post by giritime » 09 Nov 2014 08:30

ShadowThief wrote:And since people here care about this, cross-posted on StackOverflow at http://stackoverflow.com/questions/2682 ... -batch-cmd (although for what it's worth, it was posted here first).


I was just trying my luck.

giritime
Posts: 3
Joined: 08 Nov 2014 16:22

Re: Not able to create tables by using batch cmd

#5 Post by giritime » 09 Nov 2014 08:36

Sorry i didn't get the suggestion you suggested can you please elaborate in detail?

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Not able to create tables by using batch cmd

#6 Post by Squashman » 09 Nov 2014 11:58

giritime wrote:Sorry i didn't get the suggestion you suggested can you please elaborate in detail?

You never output those variables to any file.

ShadowThief
Expert
Posts: 1167
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Not able to create tables by using batch cmd

#7 Post by ShadowThief » 09 Nov 2014 12:19

giritime wrote:Sorry i didn't get the suggestion you suggested can you please elaborate in detail?

That thing that you marked as the solution on StackOverflow? Do that.

Signed,
The guy who goes by SomethingDark on the other site.

Post Reply