圆月山庄资源网 Design By www.vgjia.com
a.txt
代码:
[Promise don't come easy]
I should have known all along.
There was something wrong.
I just never read between the lines.
Then I woke up one day and found you on your way.
Leaving nothing but my heart behind.
What can I do to make it up to you.
Promises don't come easy.
But tell me if there's a way to bring you back home to stay.
Well I'd promises anything to you.
I've been walkin' around with my head hanging down.
Wondrin' what I'm gonna do.
'Cause when you walked out that door.
要求,CMD原始窗口中,不调节窗口大小,不生成临时文件,居中显示文本内容。输出如下:
代码:
[Promise don't come easy]
I should have known all along.
There was something wrong.
I just never read between the lines.
Then I woke up one day and found you on your way.
Leaving nothing but my heart behind.
What can I do to make it up to you.
Promises don't come easy.
But tell me if there's a way to bring you back home to stay.
Well I'd promises anything to you.
I've been walkin' around with my head hanging down.
Wondrin' what I'm gonna do.
'Cause when you walked out that door.
Batcher:
sed -e :a -e "s/^.\{1,77\}$/ & /;ta" a.txt
sed.exe
http://xiazai.jb51.net/201010/tools/sed_jb51.rar
batman:思路说明:
以下代码是充分findstr命令的示例,使用findstr /n来取得行号同时兼容空行,
并将行号进行变量赋值;使用findstr /o来取得第行的字符偏移量,但要通过
上、下行的字符偏移差,因为字符偏移值是类计递加的,同时每行回车增加
两个字符偏移,所以不可避免要对最后一行强加回车,在不破坏原文件的情
况下只好生成临时文件;利用findstr /o能够一次性获得文本所有行的字符偏
移量也就是字符总数,效率和逐字符判断相比肯定是高得多了。
---------------------------------
复制代码 代码如下:
@echo off
copy /y 1.txt 2.txt>nul
echo.2.txt&echo end2.txt
for /f "tokens=1,2* delims=: " %%i in ('findstr /n /o .* 2.txt') do (
set "_%%i=%%j"&set ".%%i=%%k"
if %%i geq 2 call :lp %%i
)
del /q 2.txt&pause>nul&goto :eof
:lp
set /a n=%1-1
set /a num=_%1-_%n%-2
set /a kl=(80-num)/2
for /l %%i in (1,1,%kl%) do set /p= <NUL
call,set /p=%%.%n%%%<NUL&ECHO.
代码:
[Promise don't come easy]
I should have known all along.
There was something wrong.
I just never read between the lines.
Then I woke up one day and found you on your way.
Leaving nothing but my heart behind.
What can I do to make it up to you.
Promises don't come easy.
But tell me if there's a way to bring you back home to stay.
Well I'd promises anything to you.
I've been walkin' around with my head hanging down.
Wondrin' what I'm gonna do.
'Cause when you walked out that door.
要求,CMD原始窗口中,不调节窗口大小,不生成临时文件,居中显示文本内容。输出如下:
代码:
[Promise don't come easy]
I should have known all along.
There was something wrong.
I just never read between the lines.
Then I woke up one day and found you on your way.
Leaving nothing but my heart behind.
What can I do to make it up to you.
Promises don't come easy.
But tell me if there's a way to bring you back home to stay.
Well I'd promises anything to you.
I've been walkin' around with my head hanging down.
Wondrin' what I'm gonna do.
'Cause when you walked out that door.
Batcher:
sed -e :a -e "s/^.\{1,77\}$/ & /;ta" a.txt
sed.exe
http://xiazai.jb51.net/201010/tools/sed_jb51.rar
batman:思路说明:
以下代码是充分findstr命令的示例,使用findstr /n来取得行号同时兼容空行,
并将行号进行变量赋值;使用findstr /o来取得第行的字符偏移量,但要通过
上、下行的字符偏移差,因为字符偏移值是类计递加的,同时每行回车增加
两个字符偏移,所以不可避免要对最后一行强加回车,在不破坏原文件的情
况下只好生成临时文件;利用findstr /o能够一次性获得文本所有行的字符偏
移量也就是字符总数,效率和逐字符判断相比肯定是高得多了。
---------------------------------
复制代码 代码如下:
@echo off
copy /y 1.txt 2.txt>nul
echo.2.txt&echo end2.txt
for /f "tokens=1,2* delims=: " %%i in ('findstr /n /o .* 2.txt') do (
set "_%%i=%%j"&set ".%%i=%%k"
if %%i geq 2 call :lp %%i
)
del /q 2.txt&pause>nul&goto :eof
:lp
set /a n=%1-1
set /a num=_%1-_%n%-2
set /a kl=(80-num)/2
for /l %%i in (1,1,%kl%) do set /p= <NUL
call,set /p=%%.%n%%%<NUL&ECHO.
标签:
文本内容,居中显示
圆月山庄资源网 Design By www.vgjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
圆月山庄资源网 Design By www.vgjia.com
暂无评论...
更新日志
2024年11月01日
2024年11月01日
- 群星.2023-非凡医者影视原声带【华纳】【FLAC分轨】
- 《寻找弗兰基》全成就一览
- 《传说法师2》EA评测:不是亲生的不心疼
- 《射戮骑士》评测:“幸存者!去杀穿硬核地狱!”
- 群星《名声(黑胶CD)》[WAV+CUE]
- 梅艳芳《女人花》SACD[原抓WAV+CUE]
- 孙露《因为想念》【WAV+CUE】
- 罗艺恒《What Could've Been》[FLAC/分轨][130.04MB]
- 罗熙楷《笼中鸟Caged Bird》[320K/MP3][72.27MB]
- 罗熙楷《笼中鸟Caged Bird》[FLAC/分轨][191.82MB]
- 英雄联盟s14晋级四强队伍是哪些 S14全球总决赛四强战队介绍
- 魔兽世界怀旧服专家模式什么时候开 怀旧服专家模式开启时间介绍
- 魔兽世界永久60级哪个职业最强 魔兽世界永久60级职业推荐
- 上海Major赛事专属版显示器首次亮相PNL高校决赛
- 寻找中国“龙” 感受乐元素的“科普力”