本帖最后由 rzzm 于 2014-4-25 20:57 编辑
我翻了一些帖子,发现下面这个我看得懂,也能改,不过他是删除之间的内容,我想把内容保存- @set @n=0;/* & echo off
- echo,1 删除“孤寂之狼”之前内容
- echo,2 删除“97言情小说网”到“free97.cn”之间内容
- echo,3 删除“收藏此书加入书签”之后内容
- set /p Input=输入[1-3](默认3):
- dir /b *.txt|cscript -nologo -e:jscript "%~0" "%Input%"
- pause & exit/b & rem */
- arg = WScript.Arguments(0);
- fso = new ActiveXObject("Scripting.FileSystemObject");
- while (!WSH.StdIn.AtEndOfStream) {
- f = WSH.StdIn.ReadLine();
- txt = fso.OpenTextFile(f,1).ReadAll();
- if (arg == "1") {
- txt = txt.replace(/[\s\S]*孤寂之狼/,"");
- } else {
- if (arg == "2") {
- txt = txt.replace(/97言情小说网[\s\S]*?free97\.cn/ig,"");
- } else txt = txt.replace(/收藏此书加入书签[\s\S]*$/,"");
- };
- fso.OpenTextFile(f,2).Write(txt);
- }
复制代码 |