我试图创建一个界面来制作一个分屏html文件但是有一个没有返回错误代码的错误
@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
答案 0 :(得分:1)
^
字符用于显示或回显为cmd使用而保留的字符(例如<
,>
)。因此,使用<html>
而不是^<html^>
。注意&符号之前的^
。
答案 1 :(得分:0)
您需要转义正在写入文件的一些字符。
Generating html with batch .. escape quotes
例如,而不是:
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 ^<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