0

I'm trying to make an interface to make an split screen html file but there's a bug which doesn't return an error code

@echo off
color 1a
echo welcome to split screen creator - made by Tijmen
pause
cls
set /p file= type here the file name:
set /p links= left page:
set /p rechts= right page:
TimeOut 1 > nul
cls
echo generating
echo.>%file%.html <html><head><title>
echo.>%file%.html %file%
echo.>%file%.html </title></head>
echo.>%file%.html <frameset bordercolor="black" noresize
scrolling="auto" cols="%40, %40">
echo.>%file%.html <frame src="
echo.>%file%.html %links%
echo.>%file%.html ">
echo.>%file%.html <frame src="
echo.>%file%.html %rechts%
echo.>%file%.html ">
echo.>%file%.html </frameset>
echo.>%file%.html </html>
cls
echo ready
pause
PJSimon
  • 343
  • 1
  • 18
AMOnDuck
  • 3
  • 5

2 Answers2

1

The ^ character is used to display or echo charcters (such as <, >) that are reserved for usage by cmd. So instead of <html>, ^<html^> is used. Notice the ^ before the ampersand.

SomethingDark
  • 13,229
  • 5
  • 50
  • 55
Jahwi
  • 426
  • 3
  • 14
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation](http://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](http://stackoverflow.com/help/privileges/comment). – JosefZ May 20 '15 at 22:12
  • 1
    @JosefZ - the answer is fine (and correct), it was just formatted incorrectly. – SomethingDark May 20 '15 at 23:35
0

You need to escape some of the characters you are writing to the file.

Generating html with batch .. escape quotes

For example, instead of this:

echo.>%file%.html <html><head><title>
echo.>%file%.html %file%
echo.>%file%.html </title></head>
echo.>%file%.html <frameset bordercolor="black" noresize
scrolling="auto" cols="%40, %40">

Try this:

echo ^<html^>^<head^>^<title^> > %file%.html
echo %file% >> %file%.html
echo ^</title^>^</head^> >> %file%.html
echo ^<frameset bordercolor="black" noresize scrolling="auto" cols="%%40, %%40"^> >> %file%.html
Community
  • 1
  • 1
PJSimon
  • 343
  • 1
  • 18
  • I clicked the link in my answer and used the information there to generate a code sample for you. If that works for you, please mark my answer as accepted. Thanks! – PJSimon May 20 '15 at 17:03