小说章节生成器
以下代码保存为bat格式,运行即可按提示输入并生成。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | @echo off title 小说模板生成器 color 0a ::用户输入变量定义 set /p title=请输入小说名: set /p z=请输入小说章节数: set /p i=请输入目录首页编号: set /p b=请输入正文首页编号: ::保存全局变量 set qz=%z% set qi=%i% set qb=%b% ::中间变量定义 set t=%i% set /a j=%i%-1 set /a k=%i%+1 set n=1 set a=1 set q=1 ::开始生成目录%i% :begin echo 开始生成目录%i% >> "mulu%i%.htm" ECHO ^<html^> >> "mulu%i%.htm" ECHO ^<head^> >> "mulu%i%.htm" ECHO ^<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /^> >> "mulu%i%.htm" ECHO ^<title^>%title%目录%q%^</title^> >> "mulu%i%.htm" ECHO ^</head^> >> "mulu%i%.htm" ECHO ^<body^> >> "mulu%i%.htm" ECHO ^<p^>%title%目录%q%^</p^> ::判断是否为目录首页 if %i% equ %t% goto huanhang >> "mulu%i%.htm" ECHO ^<p^>^<a href="mulu%j%.htm"^>上一页^</a^>^</p^> :huanhang >> "mulu%i%.htm" ECHO ^<p^> ::开始生成目录超链接部分 :mulu >> "mulu%i%.htm" ECHO ^<a href="%b%.htm"^>%a%^</a^>^ set /a yyy=%a%%%50 if %a% equ %z% goto muluend if %yyy% equ 0 goto endi if %n% equ 5 goto n set /a a=%a%+1 set /a b=%b%+1 set /a n=%n%+1 goto mulu :n >> "mulu%i%.htm" ECHO ^</p^> >> "mulu%i%.htm" ECHO ^<p^> set n=1 set /a a=%a%+1 set /a b=%b%+1 goto mulu :endi >> "mulu%i%.htm" ECHO ^</p^> >> "mulu%i%.htm" ECHO ^<p^>^<a href="mulu%k%.htm"^>下一页^</a^>^</p^> >> "mulu%i%.htm" ECHO ^<p^>^<a href="index.htm"^>返回首页^</a^>^</p^> >> "mulu%i%.htm" ECHO ^</body^> >> "mulu%i%.htm" ECHO ^</html^> set /a j=%j%+1 set /a k=%k%+1 set /a i=%i%+1 set /a q=%q%+1 set /a a=%a%+1 set /a b=%b%+1 set n=1 goto begin :muluend >> "mulu%i%.htm" ECHO ^</p^> >> "mulu%i%.htm" ECHO ^<p^>^<a href="index.htm"^>返回首页^</a^>^</p^> >> "mulu%i%.htm" ECHO ^</body^> >> "mulu%i%.htm" ECHO ^</html^> echo 目录生成完毕 echo. echo. echo 目录生成完毕,开始生成正文... ::目录生成完毕,开始生成正文 ::变量传递 set z=%qz% set i=%qi% set a=%qb% set /a b=%a%-1 set /a c=%a%+1 set /a rz=%z%+1 set n=1 set t=%a% set /a z=%z%+%a% :zwbegin echo 正在生成%a%.htm >> "%a%.htm" ECHO ^<html^> >> "%a%.htm" ECHO ^<head^> >> "%a%.htm" ECHO ^<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /^> >> "%a%.htm" ECHO ^<title^>%title%%n%^</title^> >> "%a%.htm" ECHO ^</head^> >> "%a%.htm" ECHO ^<body^> if %a% equ %t% goto zwone >> "%a%.htm" ECHO ^<p^>^<a href="%b%.htm"^>上一页^</a^>^</p^> :zwone >> "%a%.htm" ECHO ^<p^>^</p^> if %a%==%z% goto zwz >> "%a%.htm" ECHO ^<p^>^<a href="%c%.htm"^>下一页^</a^>^</p^> :zwz >> "%a%.htm" ECHO ^<p^>^<a href="mulu%i%.htm"^>返回目录^</a^>^</p^> >> "%a%.htm" ECHO ^<p^>^<a href="index.htm"^>返回首页^</a^>^</p^> >> "%a%.htm" ECHO ^</body^> >> "%a%.htm" ECHO ^</html^> set /a a=%a%+1 set /a b=%b%+1 set /a c=%c%+1 set /a n=%n%+1 if %n%==%rz% goto end goto zwbegin :end echo 正文生成完成! echo 网页模板生成完成! pause>nul |