BATCH 中的调用不起作用

发布于 2024-11-01 00:31:45 字数 697 浏览 3 评论 0原文

我创建了名为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云雾 2024-11-08 00:31:45

我认为它只是有效:执行不会停止,只有回显停止!

请检查您的输出文件 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…

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文