BATCH 中的调用不起作用
我创建了名为 a.bat 的文件
call echo. > outfile
call dup.bat file1 outfile 7
call MORE file2 >> outfile
call dup.bat file1 outfile 10
,当我执行它时,输出是
C:\>a
C:\>call echo. 1>outfile
C:\>call dup.bat file1 outfile 7
C:\>
我不明白为什么它在执行第一批处理后停止执行,
该批处理是这个问题的答案 如何在批处理中进行循环?
dup.bat
@ECHO off
SET infile=%1
SET outfile=%2
SET times=%3
rem IF EXIST %outfile% DEL %outfile%
FOR /L %%i IN (1,1,%times%) DO (
call MORE %infile% >> %outfile%
)
也许一些无声的异常是被扔?怎么抓住它?
有什么想法吗?
I have created file called a.bat
call echo. > outfile
call dup.bat file1 outfile 7
call MORE file2 >> outfile
call dup.bat file1 outfile 10
when I execute it the output is
C:\>a
C:\>call echo. 1>outfile
C:\>call dup.bat file1 outfile 7
C:\>
I don't understand why it stops the excution after executing the first batch
the batch is an answer to this question
how to do loop in Batch?
the dup.bat
@ECHO off
SET infile=%1
SET outfile=%2
SET times=%3
rem IF EXIST %outfile% DEL %outfile%
FOR /L %%i IN (1,1,%times%) DO (
call MORE %infile% >> %outfile%
)
Maybe some silent exception is being thrown? how to catch it?
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为它只是有效:执行不会停止,只有回显停止!
请检查您的输出文件
outfile
并验证其内容。您看不到 a.bat 最后两行的原因是 dup.bat 关闭了 echo...I think it just works: execution does not stop, only echo stops!
Please check your output file
outfile
and verify its contents. The reason that you do not see the last two lines of a.bat is that dup.bat turns echo off…