会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
不做IT民工
专注wcf mvc jquery,挫折是前进的垫脚石,共享知识来提高自己水平
博客园
首页
新随笔
联系
订阅
管理
批命令处理重命名
Code
1
@echo
on
2
setlocal
enabledelayedexpansion
3
cd
F:
\
movie
\
走遍美国视频全集
4
dir
*
.
srt
/
s
/
a-d
/
b
>>
temp
.
txt
5
6
set
filename
=
""
7
set
tempname
=
""
8
set
count
=
1
9
for
/
f %%i in
(
temp
.
txt
)
do
(
10
set
filename
=
%%i
11
echo
!filename!
12
set
filename
=
!filename:~
18
!
13
set
tempname
=
!filename!
14
call
:stringlenth
"
!filename!
"
count
15
echo
!count!
16
if
!count! LSS
8
set
tempname
=
走遍美国!filename!
17
echo
!filename!
18
echo
!tempname!
19
ren
"
!filename!
"
"
!tempname!
"
20
)
21
22
ENDLOCAL
23
24
exit
25
26
:StringLenth
27
28
set
theString
=
%~
1
29
if
not
defined theString
goto
:eof
30
set
Return
=
0
31
:StringLenth_continue
32
set
/
a
Return
+=
1
33
set
thestring
=
%thestring:~
0
,
-
1
%
34
if
defined thestring
goto
StringLenth_continue
35
if
not
"
%2
"
==
""
set
%2
=
%
Return
%
36
goto
:eof
37
38
rem
删除临时文件del temp.txt /q 1>nul 2>nulpause
39
40
rem
总结在for循环中要用延迟变量
由于我下载了走遍美国视频,而字幕又要额外下载,下载的字母跟视频文件名不一样,需要增加四个字走遍美国,
我就写了上面的批处理来改,只是为了学习批处理。一共有78个文件。
有些代码是无用的,只是为了来调试
要是懂了语法,看起来不是很麻烦的
posted @
2009-08-22 16:04
潇潇息一去不复返
阅读(
468
) 评论(
0
)
收藏
举报
刷新页面
返回顶部
公告
努力才能前进,勤耕博客才能看远