[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

【练习-006】批处理实现文本内容居中显示

a.txt
  1. [Promise don't come easy]
  2. I should have known all along.
  3. There was something wrong.
  4. I just never read between the lines.
  5. Then I woke up one day and found you on your way.
  6. Leaving nothing but my heart behind.
  7. What can I do to make it up to you.
  8. Promises don't come easy.
  9. But tell me if there's a way to bring you back home to stay.
  10. Well I'd promises anything to you.
  11. I've been walkin' around with my head hanging down.
  12. Wondrin' what I'm gonna do.
  13. 'Cause when you walked out that door.
复制代码
要求,CMD原始窗口中,不调节窗口大小,不生成临时文件,居中显示文本内容。输出如下:
  1.                           [Promise don't come easy]
  2.                         I should have known all along.
  3.                           There was something wrong.
  4.                      I just never read between the lines.
  5.               Then I woke up one day and found you on your way.
  6.                      Leaving nothing but my heart behind.
  7.                      What can I do to make it up to you.
  8.                           Promises don't come easy.
  9.          But tell me if there's a way to bring you back home to stay.
  10.                       Well I'd promises anything to you.
  11.              I've been walkin' around with my head hanging down.
  12.                          Wondrin' what I'm gonna do.
  13.                     'Cause when you walked out that door.
复制代码

-----------------------------------------------------------------------------------
至此,已有比较完美的答案,见2楼sed版,与6楼findstr版。

[ 本帖最后由 pusofalse 于 2008-7-31 21:17 编辑 ]
心绪平和,眼藏静谧。

高~ 竟然一句搞定。^_^

[ 本帖最后由 pusofalse 于 2008-7-31 12:11 编辑 ]
心绪平和,眼藏静谧。

TOP

返回列表