在cmd中创建长文本文件

时间:2013-05-12 13:01:47

标签: file text cmd

简单的问题我需要使用批处理文件创建reset.css文件。我知道如何制作短文本文件但是当试图输入长文本时它不起作用。

这是文字

    html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
    display: block;
}
body {
    line-height: 1;
}
ol, ul {
    list-style: none;
}
blockquote, q {
    quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
    content: '';
    content: none;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
}

我只需要一些命令,这样我就可以将此文本粘贴到批处理文件中,以便保存它

2 个答案:

答案 0 :(得分:1)

这与其他答案中的代码相同,但更改为允许更容易编辑和正确的文件名。

@echo off
set "file=reset.css"
>>%file% echo     html, body, div, span, applet, object, iframe,
>>%file% echo h1, h2, h3, h4, h5, h6, p, blockquote, pre,
>>%file% echo a, abbr, acronym, address, big, cite, code,
>>%file% echo del, dfn, em, img, ins, kbd, q, s, samp,
>>%file% echo small, strike, strong, sub, sup, tt, var,
>>%file% echo b, u, i, center,
>>%file% echo dl, dt, dd, ol, ul, li,
>>%file% echo fieldset, form, label, legend,
>>%file% echo table, caption, tbody, tfoot, thead, tr, th, td,
>>%file% echo article, aside, canvas, details, embed, 
>>%file% echo figure, figcaption, footer, header, hgroup, 
>>%file% echo menu, nav, output, ruby, section, summary,
>>%file% echo time, mark, audio, video {
>>%file% echo     margin: 0;
>>%file% echo     padding: 0;
>>%file% echo     border: 0;
>>%file% echo     font-size: 100%%;
>>%file% echo     font: inherit;
>>%file% echo     vertical-align: baseline;
>>%file% echo }
>>%file% echo /* HTML5 display-role reset for older browsers */
>>%file% echo article, aside, details, figcaption, figure, 
>>%file% echo footer, header, hgroup, menu, nav, section {
>>%file% echo     display: block;
>>%file% echo }
>>%file% echo body {
>>%file% echo     line-height: 1;
>>%file% echo }
>>%file% echo ol, ul {
>>%file% echo     list-style: none;
>>%file% echo }
>>%file% echo blockquote, q {
>>%file% echo     quotes: none;
>>%file% echo }
>>%file% echo blockquote:before, blockquote:after,
>>%file% echo q:before, q:after {
>>%file% echo     content: '';
>>%file% echo     content: none;
>>%file% echo }
>>%file% echo table {
>>%file% echo     border-collapse: collapse;
>>%file% echo     border-spacing: 0;
>>%file% echo }

答案 1 :(得分:0)

您需要转义特殊字符并使用引号! :)

这是我使用TextZipper ...

所得到的
@echo off
echo Textzipper is writing the files...
echo     html, body, div, span, applet, object, iframe, >> "asd.txt"
echo h1, h2, h3, h4, h5, h6, p, blockquote, pre, >> "asd.txt"
echo a, abbr, acronym, address, big, cite, code, >> "asd.txt"
echo del, dfn, em, img, ins, kbd, q, s, samp, >> "asd.txt"
echo small, strike, strong, sub, sup, tt, var, >> "asd.txt"
echo b, u, i, center, >> "asd.txt"
echo dl, dt, dd, ol, ul, li, >> "asd.txt"
echo fieldset, form, label, legend, >> "asd.txt"
echo table, caption, tbody, tfoot, thead, tr, th, td, >> "asd.txt"
echo article, aside, canvas, details, embed,  >> "asd.txt"
echo figure, figcaption, footer, header, hgroup,  >> "asd.txt"
echo menu, nav, output, ruby, section, summary, >> "asd.txt"
echo time, mark, audio, video { >> "asd.txt"
echo     margin: 0; >> "asd.txt"
echo     padding: 0; >> "asd.txt"
echo     border: 0; >> "asd.txt"
echo     font-size: 100%%; >> "asd.txt"
echo     font: inherit; >> "asd.txt"
echo     vertical-align: baseline; >> "asd.txt"
echo } >> "asd.txt"
echo /* HTML5 display-role reset for older browsers */ >> "asd.txt"
echo article, aside, details, figcaption, figure,  >> "asd.txt"
echo footer, header, hgroup, menu, nav, section { >> "asd.txt"
echo     display: block; >> "asd.txt"
echo } >> "asd.txt"
echo body { >> "asd.txt"
echo     line-height: 1; >> "asd.txt"
echo } >> "asd.txt"
echo ol, ul { >> "asd.txt"
echo     list-style: none; >> "asd.txt"
echo } >> "asd.txt"
echo blockquote, q { >> "asd.txt"
echo     quotes: none; >> "asd.txt"
echo } >> "asd.txt"
echo blockquote:before, blockquote:after, >> "asd.txt"
echo q:before, q:after { >> "asd.txt"
echo     content: ''; >> "asd.txt"
echo     content: none; >> "asd.txt"
echo } >> "asd.txt"
echo table { >> "asd.txt"
echo     border-collapse: collapse; >> "asd.txt"
echo     border-spacing: 0; >> "asd.txt"
echo } >> "asd.txt"
echo Done.