Computing.Net > Forums > Disk Operating System > how to ECHO an HTML tag in DOS?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

how to ECHO an HTML tag in DOS?

Reply to Message Icon

Name: May
Date: September 26, 2002 at 11:03:07 Pacific
OS: WinXP
CPU/Ram: P400/192Mb
Comment:

How can I use the ECHO command to write an HTML tag to a text file?

I'm creating a DOS batch script to write some HTML tags to a text file.

If I type [b][color=red]echo HTML > output.txt[/color][/b] at command

prompt then the word [b][color=red]HTML[/color][/b] is correctly

written to a text file called "output.txt".

But if I try [b][color=red]echo > output.txt[/color][/b] then it

doesn't work, obviously because DOS is trying to interpret the that

are surround the word [b][color=red]HTML[/color][/b] .

I tried putting quotes around the tag, like this: [b][color=red]echo

"" > output.txt[/color][/b] but this stores the tag and the quotes

as well, which is no good.

The ideal solution would be to remove the quotes, but I have scanned the

Net and can't find how to do this.

Any ideas?

May



Sponsored Link
Ads by Google

Response Number 1
Name: Secret_Doom
Date: September 26, 2002 at 11:38:36 Pacific
Reply:

Geeze, did you read your post after posting it? This forum doesn't interpret "[b]" or "[color=red]" as font formatting. Another thing, this forum has some trouble in displaying the less-than character (<).

May wrote:
> But if I try [b][color=red]
> echo > output.txt[/color][/b]
> then it

I think you meant something more, probably there was an HTML tag after the word "echo", right?

I'll be representing the less-than and greater-than characters as []'s. Example:

[HTML][BODY]
this is an HTML document
[/BODY][/HTML]

Got it? Ok, let's say you want to create the following document via batch file:

[HTML]
[HEAD]
[TITLE]Sample HTML document[/TITLE]
[/HEAD]
[BODY bgcolor="red"]
Hello, Mama!
[/BODY]
[/HTML]

This batch script would do it:

===== BATCH SCRIPT BEGIN =====
@echo off
echo %0? |FIND /i ".BAT?" > nul
if not errorlevel=1 set THIS=%0
if errorlevel=1 set THIS=%0.BAT
set char= %=%
set char= %char%
FIND "%char%" < %THIS% > sample.htm
for %%? in (char this) do set %%?=
goto eof

  [HTML]
  [HEAD]
  [TITLE]Sample HTML document[/TITLE]
  [/HEAD]
  [BODY bgcolor="red"]
  Hello, Mama!
  [/BODY]
  [/HTML]

:eof
===== BATCH SCRIPT END =====

Note that the secction which have the HTML file has a double space on the beginning of each line. You MUST include that double space on all the lines which are going to the HTML file, and you MUST NOT include that combination of characters anywhere else on the batch.

-- Leonardo Pignataro - Secret_Doom --

secret_doom@hotmail.com
www.batch.hpg.com.br


0

Response Number 2
Name: Flea
Date: September 26, 2002 at 12:03:32 Pacific
Reply:

"Geeze, did you read your post after posting it? This forum doesn't interpret "[b]" or "[color=red]" as font formatting. "

Uh, he wasn't trying to. He was giving examples of what he wants to do in DOS.


0

Response Number 3
Name: Secret_Doom
Date: September 27, 2002 at 09:49:12 Pacific
Reply:

Flea wrote:
> Uh, he wasn't trying to. He was giving
> examples of what he wants to do in DOS.

I don't think so. Carefully read this:

May wrote:
> If I type [b][color=red]echo
> HTML > output.txt[/color][/b]
> at command

The "tags" are ending after the filename, it doesn't seem to me that May is trying to ECHO those tags into the file output.txt, as you suggested.

-- Leonardo Pignataro - Secret_Doom --

secret_doom@hotmail.com
www.batch.hpg.com.br


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: how to ECHO an HTML tag in DOS?

HOW TO Change Date Format in DOS www.computing.net/answers/dos/how-to-change-date-format-in-dos/4848.html

How to create a log file in 1 line www.computing.net/answers/dos/how-to-create-a-log-file-in-1-line/12735.html

How to Find yours NIC macaddress in DOS? www.computing.net/answers/dos/how-to-find-yours-nic-macaddress-in-dos/2296.html