请教下,怎样让当前路径批处理运行子目录中bat?
1个回答
展开全部
试一下:保存到与rt1同级的目录中即可运行。
@echo
off
@setlocal
enabledelayedexpansion
:start
@set
/a
lno=0
@set
filename=ppp.txt
@for
/f
"delims="
%%k
in
('dir
/a/b/s
%filename%‘)
do
(
@for
/f
"usebackq
delims="
%%i
in
("%%~fk")
do
(
set
/a
lno+=1
set
"line!lno!=%%i"
rem
call
echo
line!lno!:
[%%line!lno!%%]
)
@if
%lno%
lss
8
(echo
warning:
该文件只有%lno%行,未做处理!
&goto
end)
@set
line8=ppp
show
=128
@for
/l
%%i
in
(1,1,%lno%)
do
(
echo
!line%%i!
>>%filename%.tmp
)
@move
/y
%filename%
%filename%.old
@move
/y
%filename%.tmp
%filename%
@echo
成功执行!!
:end
@endlocal
@echo
off
@setlocal
enabledelayedexpansion
:start
@set
/a
lno=0
@set
filename=ppp.txt
@for
/f
"delims="
%%k
in
('dir
/a/b/s
%filename%‘)
do
(
@for
/f
"usebackq
delims="
%%i
in
("%%~fk")
do
(
set
/a
lno+=1
set
"line!lno!=%%i"
rem
call
echo
line!lno!:
[%%line!lno!%%]
)
@if
%lno%
lss
8
(echo
warning:
该文件只有%lno%行,未做处理!
&goto
end)
@set
line8=ppp
show
=128
@for
/l
%%i
in
(1,1,%lno%)
do
(
echo
!line%%i!
>>%filename%.tmp
)
@move
/y
%filename%
%filename%.old
@move
/y
%filename%.tmp
%filename%
@echo
成功执行!!
:end
@endlocal
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询