Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
正在使用批处理生成html。。转义引号_Html_Batch File_Escaping_Quotes - Fatal编程技术网

正在使用批处理生成html。。转义引号

正在使用批处理生成html。。转义引号,html,batch-file,escaping,quotes,Html,Batch File,Escaping,Quotes,这是为了生成一个包含不同文件的web文档的层次结构,这是因为我很懒 @echo off echo. echo This program will generate the base folder for a new website .. . pause md folders echo > folders/default.html "<html> /* More content */ </html>" echo > fold

这是为了生成一个包含不同文件的web文档的层次结构,这是因为我很懒

@echo off
echo.
echo This program will generate the base folder for a new website .. .
pause
md folders
echo >  folders/default.html  "<html> /* More content */ </html>"
echo >  folders/style.css " /* All the standards i always use */ "
echo >  folders/javascript.js " /* All the standards i always use */ "
echo.
exit
它也能起作用,但问题是,我不能删除/逃避引用,尽管这会让人歇斯底里


我尝试了很多不同的东西。使用类型更改echo,我尝试了在www等上可以找到的不同转义选项,但引号仍然存在。

您需要转义所有CMD保留字符
^
使用插入符号
^

几点意见

  • 如果保留字符在引号内,则不要将其转义
  • 如果它们不在if、FOR或其他圆括号块中,则不需要转义(and)
  • 一个更完整的例子是

    echo ^<!DOCTYPE HTML PUBLIC^> >index.html
    echo ^<html^> >>index.html
    echo ^<!-- more content --^> >>index.html
    echo ^<!-- you don't need to escape ( ) outside blocks --^> >>index.html
    echo ^<!-- don't escape inside quotes "&" --^> >>index.html
    echo ^</html^> >>index.html
    
    echo^>index.html
    echo^>>index.html
    echo^可能的副本