2013-05-12 82 views
0

簡單的問題,我需要創建具有批處理文件的reset.css文件。我知道如何製作短文本文件,但在嘗試輸入長文本時無法使用。在cmd中創建長文本文件

這裏的文字

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; 
} 

我只是需要一些命令,所以我可以在這個文本粘貼到批處理文件,所以可以將它保存

回答

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. 
+0

認真有沒有其他更短的方式? – 2013-05-12 14:52:51

+0

你用特殊字符'<> |&'測試過了嗎? – Endoro 2013-05-12 14:56:01

+1

@Endoro TextZipper自動轉義它們:D – 2013-05-12 15:59:32

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 } 
+0

有趣! :d – 2013-05-12 22:59:57