Q:

Add a string of text into a html document using cmd/batch file

I would like to add a string of text into a html document.
My website has an "update" part where you can see where they drove to. (Its a website for some bikers)
I would like to do it so my dad just need to open a bat file type a little information and then it would add the string to the html document.
Im currently using a "table" as the layout.
This is the code:
 <tr style="mso-yfti-irow:34">
    <td valign="top" style="width:180;padding-left:3.5pt; padding-light:3.5pt; padding-top:0cm; padding-bottom:0cm" height="5">
        <font size="4">DATE</font>
    </td>
    <td valign="top" style="width:500;padding-left:3.5pt; padding-right:3.5pt; padding-top:0cm; padding-bottom:0cm" height="5">
         <font size="4">LOCATION</font></td>
    <td valign="top" style="width:523;padding-left:3.5pt; padding-right:3.5pt; padding-top:0cm; padding-bottom:0cm" height="5">
        <font size="4">AMOUNT</font>
    </td>
 </tr>

Current website 
<html>
    <head>
        Some things here....
    </head>
    <body>
        <div>
            More things here
        </div>
        <table>
            the table/the place where new text should be added
        </table>
        A bit more
    </body>
 </html>    

What I was thing was that I could make a bat file with this code 
echo off
set /p Date="Date: "
set /p Location="Location: "
set /p Amount="Amount: "

(some command here to add it)

<tr style="mso-yfti-irow:34">
    <td valign="top" style="width:180;padding-left:3.5pt; padding-right:3.5pt; padding-top:0cm; padding-bottom:0cm" height="5">
    <font size="4">%Date%</font></td>
    <td valign="top" style="width:500;padding-left:3.5pt; padding-right:3.5pt; padding-top:0cm; padding-bottom:0cm" height="5">
    <font size="4">%Location%</font></td>
    <td valign="top" style="width:523;padding-left:3.5pt; padding-right:3.5pt; padding-top:0cm; padding-bottom:0cm" height="5">
    <font size="4">%Amount%</font></td>
</tr>

Exit

New text should always be added at the bottom of the table, however not the bottom of the html document

The line nr. will also always change

I hope I explained this well enough, if there was something you didn't understand then just write, then I'll try to clarify

A:

Sounds like you already have the bat script written to prompt your dad for the values.  So I will focus on how to insert those into your html page.
In your current html file, change the formatting of the end of your table, placing the last </tr> directly in front of the </table>
</tr></table>

in your bat file, replace
(some command here to add it)
<tr style="mso-yfti-irow:34">
   <td valign="top" style="width:180;padding-left:3.5pt; padding-right:3.5pt; padding-top:0cm; padding-bottom:0cm" height="5">
   <font size="4">%Date%</font></td>
   <td valign="top" style="width:500;padding-left:3.5pt; padding-right:3.5pt; padding-top:0cm; padding-bottom:0cm" height="5">
   <font size="4">%Location%</font></td>
   <td valign="top" style="width:523;padding-left:3.5pt; padding-right:3.5pt; padding-top:0cm; padding-bottom:0cm" height="5">
   <font size="4">%Amount%</font></td>
   </tr>

with this
powershell -command "(Get-Content Name_of_File.html) -replace '</tr></table>', '<tr style=&quot;mso-yfti-irow:34&quot;> <td valign=&quot;top&quot; style=&quot;width:180;padding-left:3.5pt; padding-right:3.5pt; padding-top:0cm; padding-bottom:0cm&quot; height=&quot;5&quot;><font size=&quot;4&quot;>%Date%</font></td><td valign=&quot;top&quot; style=&quot;width:500;padding-left:3.5pt; padding-right:3.5pt; padding-top:0cm; padding-bottom:0cm&quot; height=&quot;5&quot;><font size=&quot;4&quot;>%Location%</font></td><td valign=&quot;top&quot; style=&quot;width:523;padding-left:3.5pt; padding-right:3.5pt; padding-top:0cm; padding-bottom:0cm&quot; height=&quot;5&quot;><font size=&quot;4&quot;>%Amount%</font></td></tr></table>' | Set-Content Name_of_File.html"
Powershell.exe -executionpolicy remotesigned -File replace_quot.ps1

This will execute a PowerShell search and replace command from within your batch script to find </tr></table> and replace it with the new row.  Each time your dad adds a new trip to the page, it will add the information to the bottom of the table.
The powershell -command lets batch know to execute everthing between the "double quotes" as powershell.  The get-content reads your html file.  So replace Name_of_File.html with the name of your HTML page.
The next part of the command performs a search and replace.  You must use &quot&semi instead " for powershell to read the entire line as a fluid set of actions.  It will write the HTML code and use your variables of %Date%, %Location% and %Amount% for the new values.
The file is then written back to the html page using set-content.  So make sure the Name_of_File.html is updated here as well with the name of your HTML page.
Save the following line in a different script named replace_quot.ps1 and place this script in the same directory as your bat file.
(Get-Content Name_of_File.html) -replace '&quot;', '"' | set-content Name_of_File.html

This script will be called by your bat file to replace the &qout; with the actual " character in your html file.

