gpt4 book ai didi

batch-file - 如何在 MSDOS 的批处理文件中使用 "start"退出

转载 作者:行者123 更新时间:2023-12-04 13:09:42 24 4
gpt4 key购买 nike

我想复制一些文件到不同的U盘,想用START打开几个控制台如下:

start copy a.txt h:
start copy a.txt i:
start copy a.txt j:

但是每次运行批处理文件时,都会有3个控制台没有退出。
我怎样才能实现这个 EXIT 功能 使用 3 个批处理文件和“调用”命令:

复制.bat:
call a.bat
call b.bat
call c.bat
exit

和三个称为批处理文件:

一只 bat :
start copy a.txt h:
exit

b. bat :
start copy a.txt i:
exit

c.bat:
start copy a.txt j:
exit

我已经尝试过这个,但它不起作用:
start copy a.txt h: && exit
start copy a.txt i: && exit
start copy a.txt j: && exit

最佳答案

您需要转义 && 以便它成为 start 执行的命令的一部分,而不是父批处理文件。

start copy a.txt h: ^&^& exit

即使出现错误,也要关闭新控制台,您可以执行以下操作:
start "" "%comspec%" /c copy a.txt h:

关于batch-file - 如何在 MSDOS 的批处理文件中使用 "start"退出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9077793/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com