Board logo

标题: [文本处理] 怎么把批处理运行完毕后界面上的+/去掉? [打印本页]

作者: 李道001    时间: 2021-1-1 20:21     标题: 怎么把批处理运行完毕后界面上的+/去掉?

  1. <# :
  2. echo off&cls
  3. rem 将多个html文件生成列表导航链接,取title标题作为文字导航标签
  4. mode con lines=5000
  5. echo 欢迎使用html文件索引生成器 提示:请把该工具放入html文件夹内运行
  6. echo 正在生成索引,请稍等......
  7. title %#% +%$%%$%/%_% %z%
  8. cd /d "%~dp0"
  9. powershell -NoProfile -ExecutionPolicy bypass "Invoke-Command -ScriptBlock ([ScriptBlock]::Create([IO.File]::ReadAllText('%~f0',[Text.Encoding]::GetEncoding('GB2312')))) -Args '%~f0'"
  10. echo;%#% +%$%%$%/%_% %z%
  11. pause>nul
  12. exit
  13. #>
  14. $ext=@(".htm",".html");
  15. $outfile=".\首页.html";
  16. $self=get-item -liter $args[0];
  17. $path=$self.Directory.FullName;
  18. $outfile=$outfile -replace '^\.',$path;
  19. function checkencoding($t){
  20. $tmpenc=New-Object System.Text.UTF8Encoding $False;
  21. $m=[regex]::match($t, '(?i)<meta .*?charset=["'']?(gbk|gb2312)');
  22. if($m.Success){$tmpenc=[Text.Encoding]::GetEncoding('GB2312');};
  23. return $tmpenc;
  24. };
  25. $outtext=@'
  26. <html>
  27. <head><meta charset="UTF-8"></head>
  28. <body>
  29. x
  30. </body>
  31. </html>
  32. '@;
  33. [System.Collections.ArrayList]$s=@();
  34. $files=@(dir -liter $path|?{($ext -contains $_.Extension) -and ($_ -is [System.IO.FileInfo])});
  35. for($i=0;$i -lt $files.length;$i++){
  36. $enc=New-Object System.Text.UTF8Encoding $False;
  37. $tmptext=[IO.File]::ReadAllText($files[$i].FullName, $enc);
  38. $enc=checkencoding $tmptext;
  39. $tmptext=[IO.File]::ReadAllText($files[$i].FullName, $enc);
  40. $m=[regex]::match($tmptext,'(?i)<title(?: [^>]+)?>([\s\S]+)</title>');
  41. if($m.success){
  42. $line='<a href="'+$files[$i].Name+'">'+$m.groups[1].value+'</a><br>';
  43. [void]$s.add($line);
  44. };
  45. };
  46. $outtext=$outtext.replace('x', ($s -join "`r`n"));
  47. [IO.File]::WriteAllText($outfile, $outtext, [Text.Encoding]::GetEncoding('UTF-8'));
  48. echo 生成索引完成,按Enter退出......
  49. pause
复制代码

作者: terse    时间: 2021-1-2 17:54

去掉或者修改第十行
echo;%#% +%$%%$%/%_% %z%

貌似 多一个暂停了
作者: 李道001    时间: 2021-1-2 20:23

回复 2# terse

关于修改怎么修改,大神,给个代码,谢谢你的热心解答了
作者: terse    时间: 2021-1-2 20:56

回复 3# 李道001
删除那行就不显示了啊 还有最后行PAUSE 是重复的吧 删除掉




欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2